Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 33 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 63 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_SND_DEBUG |
| 65 | ALC880_TEST, |
| 66 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 67 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 68 | ALC880_MODEL_LAST /* last tag */ |
| 69 | }; |
| 70 | |
| 71 | /* ALC260 models */ |
| 72 | enum { |
| 73 | ALC260_BASIC, |
| 74 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 75 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 76 | ALC260_HP_3013, |
| 77 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 78 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 79 | ALC260_WILL, |
| 80 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 81 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 82 | #ifdef CONFIG_SND_DEBUG |
| 83 | ALC260_TEST, |
| 84 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 85 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 86 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 89 | /* ALC262 models */ |
| 90 | enum { |
| 91 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 92 | ALC262_HIPPO, |
| 93 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 94 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 95 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 96 | ALC262_HP_BPC_D7000_WL, |
| 97 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 98 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 99 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 100 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 101 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 102 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 103 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 104 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 105 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 106 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 108 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 109 | ALC262_AUTO, |
| 110 | ALC262_MODEL_LAST /* last tag */ |
| 111 | }; |
| 112 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 113 | /* ALC268 models */ |
| 114 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 115 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 116 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 117 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 118 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 119 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 120 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 121 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 122 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 123 | #ifdef CONFIG_SND_DEBUG |
| 124 | ALC268_TEST, |
| 125 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 126 | ALC268_AUTO, |
| 127 | ALC268_MODEL_LAST /* last tag */ |
| 128 | }; |
| 129 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 130 | /* ALC269 models */ |
| 131 | enum { |
| 132 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 133 | ALC269_QUANTA_FL1, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 134 | ALC269_AMIC, |
| 135 | ALC269_DMIC, |
| 136 | ALC269VB_AMIC, |
| 137 | ALC269VB_DMIC, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 138 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 139 | ALC269_LIFEBOOK, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 140 | ALC271_ACER, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 141 | ALC269_AUTO, |
| 142 | ALC269_MODEL_LAST /* last tag */ |
| 143 | }; |
| 144 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 145 | /* ALC861 models */ |
| 146 | enum { |
| 147 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 148 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 149 | ALC861_3ST_DIG, |
| 150 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 151 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 152 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 153 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 154 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 155 | ALC861_AUTO, |
| 156 | ALC861_MODEL_LAST, |
| 157 | }; |
| 158 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 159 | /* ALC861-VD models */ |
| 160 | enum { |
| 161 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 162 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 163 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 164 | ALC861VD_3ST, |
| 165 | ALC861VD_3ST_DIG, |
| 166 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 167 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 168 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 169 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 170 | ALC861VD_AUTO, |
| 171 | ALC861VD_MODEL_LAST, |
| 172 | }; |
| 173 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 174 | /* ALC662 models */ |
| 175 | enum { |
| 176 | ALC662_3ST_2ch_DIG, |
| 177 | ALC662_3ST_6ch_DIG, |
| 178 | ALC662_3ST_6ch, |
| 179 | ALC662_5ST_DIG, |
| 180 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 181 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 182 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 183 | ALC663_ASUS_M51VA, |
| 184 | ALC663_ASUS_G71V, |
| 185 | ALC663_ASUS_H13, |
| 186 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 187 | ALC662_ECS, |
| 188 | ALC663_ASUS_MODE1, |
| 189 | ALC662_ASUS_MODE2, |
| 190 | ALC663_ASUS_MODE3, |
| 191 | ALC663_ASUS_MODE4, |
| 192 | ALC663_ASUS_MODE5, |
| 193 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 194 | ALC663_ASUS_MODE7, |
| 195 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 196 | ALC272_DELL, |
| 197 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 198 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 199 | ALC662_AUTO, |
| 200 | ALC662_MODEL_LAST, |
| 201 | }; |
| 202 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 203 | /* ALC882 models */ |
| 204 | enum { |
| 205 | ALC882_3ST_DIG, |
| 206 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 207 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 208 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 209 | ALC882_TARGA, |
| 210 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 211 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 212 | ALC885_MACPRO, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 213 | ALC885_MBA21, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 214 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 215 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 216 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 217 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 218 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 219 | ALC883_3ST_2ch_DIG, |
| 220 | ALC883_3ST_6ch_DIG, |
| 221 | ALC883_3ST_6ch, |
| 222 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 223 | ALC883_TARGA_DIG, |
| 224 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 225 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 226 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 227 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 228 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 231 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 232 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 233 | ALC883_MEDION_MD2, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 234 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 235 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 236 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 237 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 238 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 239 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 240 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 241 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 242 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 243 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 244 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 245 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 246 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 247 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 248 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 249 | ALC889A_INTEL, |
| 250 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 251 | ALC888_ASUS_M90V, |
| 252 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 253 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 254 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 255 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 256 | ALC882_AUTO, |
| 257 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 258 | }; |
| 259 | |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 260 | /* ALC680 models */ |
| 261 | enum { |
| 262 | ALC680_BASE, |
| 263 | ALC680_AUTO, |
| 264 | ALC680_MODEL_LAST, |
| 265 | }; |
| 266 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 267 | /* for GPIO Poll */ |
| 268 | #define GPIO_MASK 0x03 |
| 269 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 270 | /* extra amp-initialization sequence types */ |
| 271 | enum { |
| 272 | ALC_INIT_NONE, |
| 273 | ALC_INIT_DEFAULT, |
| 274 | ALC_INIT_GPIO1, |
| 275 | ALC_INIT_GPIO2, |
| 276 | ALC_INIT_GPIO3, |
| 277 | }; |
| 278 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 279 | struct alc_mic_route { |
| 280 | hda_nid_t pin; |
| 281 | unsigned char mux_idx; |
| 282 | unsigned char amix_idx; |
| 283 | }; |
| 284 | |
| 285 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 286 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 287 | struct alc_customize_define { |
| 288 | unsigned int sku_cfg; |
| 289 | unsigned char port_connectivity; |
| 290 | unsigned char check_sum; |
| 291 | unsigned char customization; |
| 292 | unsigned char external_amp; |
| 293 | unsigned int enable_pcbeep:1; |
| 294 | unsigned int platform_type:1; |
| 295 | unsigned int swap:1; |
| 296 | unsigned int override:1; |
| 297 | }; |
| 298 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | struct alc_spec { |
| 300 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 301 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 303 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 304 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 306 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 307 | * don't forget NULL |
| 308 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 309 | */ |
| 310 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 312 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | struct hda_pcm_stream *stream_analog_playback; |
| 314 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 315 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 316 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 318 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | struct hda_pcm_stream *stream_digital_playback; |
| 320 | struct hda_pcm_stream *stream_digital_capture; |
| 321 | |
| 322 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 323 | struct hda_multi_out multiout; /* playback set-up |
| 324 | * max_channels, dacs must be set |
| 325 | * dig_out_nid and hp_nid are optional |
| 326 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 327 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 328 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 329 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | |
| 331 | /* capture */ |
| 332 | unsigned int num_adc_nids; |
| 333 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 334 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 335 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 337 | /* capture setup for dynamic dual-adc switch */ |
| 338 | unsigned int cur_adc_idx; |
| 339 | hda_nid_t cur_adc; |
| 340 | unsigned int cur_adc_stream_tag; |
| 341 | unsigned int cur_adc_format; |
| 342 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 344 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | const struct hda_input_mux *input_mux; |
| 346 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 347 | struct alc_mic_route ext_mic; |
| 348 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 349 | |
| 350 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 351 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 353 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 354 | int const_channel_count; |
| 355 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | |
| 357 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 358 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 359 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 360 | /* dynamic controls, init_verbs and input_mux */ |
| 361 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 362 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 363 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 364 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 365 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 366 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 367 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 368 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 369 | /* hooks */ |
| 370 | void (*init_hook)(struct hda_codec *codec); |
| 371 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 372 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 373 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 374 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 375 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 376 | /* for pin sensing */ |
| 377 | unsigned int sense_updated: 1; |
| 378 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 379 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 380 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 381 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 382 | /* other flags */ |
| 383 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 384 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 385 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 386 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 387 | /* for virtual master */ |
| 388 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 389 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 390 | struct hda_loopback_check loopback; |
| 391 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 392 | |
| 393 | /* for PLL fix */ |
| 394 | hda_nid_t pll_nid; |
| 395 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 396 | }; |
| 397 | |
| 398 | /* |
| 399 | * configuration template - to be copied to the spec instance |
| 400 | */ |
| 401 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 402 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 403 | * with spec |
| 404 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 405 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 406 | const struct hda_verb *init_verbs[5]; |
| 407 | unsigned int num_dacs; |
| 408 | hda_nid_t *dac_nids; |
| 409 | hda_nid_t dig_out_nid; /* optional */ |
| 410 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 411 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 412 | unsigned int num_adc_nids; |
| 413 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 414 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 415 | hda_nid_t dig_in_nid; |
| 416 | unsigned int num_channel_mode; |
| 417 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 418 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 419 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 420 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 421 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 422 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 423 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 424 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 425 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 426 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 427 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 428 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 429 | }; |
| 430 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 431 | |
| 432 | /* |
| 433 | * input MUX handling |
| 434 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 435 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 436 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 437 | { |
| 438 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 439 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 440 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 441 | if (mux_idx >= spec->num_mux_defs) |
| 442 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 443 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 444 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 445 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | } |
| 447 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 448 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 449 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 450 | { |
| 451 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 452 | struct alc_spec *spec = codec->spec; |
| 453 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 454 | |
| 455 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 456 | return 0; |
| 457 | } |
| 458 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 459 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 460 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | { |
| 462 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 463 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 464 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 466 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 467 | hda_nid_t nid = spec->capsrc_nids ? |
| 468 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 469 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 470 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 471 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 472 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 473 | if (!imux->num_items && mux_idx > 0) |
| 474 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 475 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 476 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 477 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 478 | /* Matrix-mixer style (e.g. ALC882) */ |
| 479 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 480 | unsigned int i, idx; |
| 481 | |
| 482 | idx = ucontrol->value.enumerated.item[0]; |
| 483 | if (idx >= imux->num_items) |
| 484 | idx = imux->num_items - 1; |
| 485 | if (*cur_val == idx) |
| 486 | return 0; |
| 487 | for (i = 0; i < imux->num_items; i++) { |
| 488 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 489 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 490 | imux->items[i].index, |
| 491 | HDA_AMP_MUTE, v); |
| 492 | } |
| 493 | *cur_val = idx; |
| 494 | return 1; |
| 495 | } else { |
| 496 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 497 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 498 | &spec->cur_mux[adc_idx]); |
| 499 | } |
| 500 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 501 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 502 | /* |
| 503 | * channel mode setting |
| 504 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 505 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 506 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 507 | { |
| 508 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 509 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 510 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 511 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 512 | } |
| 513 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 514 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 515 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 516 | { |
| 517 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 518 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 519 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 520 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 521 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 522 | } |
| 523 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 524 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 525 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 526 | { |
| 527 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 528 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 529 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 530 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 531 | &spec->ext_channel_count); |
| 532 | if (err >= 0 && !spec->const_channel_count) { |
| 533 | spec->multiout.max_channels = spec->ext_channel_count; |
| 534 | if (spec->need_dac_fix) |
| 535 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 536 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 537 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | } |
| 539 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 541 | * 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] | 542 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 543 | * being part of a format specifier. Maximum allowed length of a value is |
| 544 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 545 | * |
| 546 | * Note: some retasking pin complexes seem to ignore requests for input |
| 547 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 548 | * are requested. Therefore order this list so that this behaviour will not |
| 549 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 550 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 551 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 552 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 553 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 554 | "Mic 50pc bias", "Mic 80pc bias", |
| 555 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 556 | }; |
| 557 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 558 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 559 | }; |
| 560 | /* 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] | 561 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 562 | * addition, "input" pins may or may not process the mic bias option |
| 563 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 564 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 565 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 566 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 567 | #define ALC_PIN_DIR_IN 0x00 |
| 568 | #define ALC_PIN_DIR_OUT 0x01 |
| 569 | #define ALC_PIN_DIR_INOUT 0x02 |
| 570 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 571 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 572 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 573 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 574 | * For each direction the minimum and maximum values are given. |
| 575 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 576 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 577 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 578 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 579 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 580 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 581 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 582 | }; |
| 583 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 584 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 585 | #define alc_pin_mode_n_items(_dir) \ |
| 586 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 587 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 588 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 589 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 590 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 591 | unsigned int item_num = uinfo->value.enumerated.item; |
| 592 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 593 | |
| 594 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 595 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 596 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 597 | |
| 598 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 599 | item_num = alc_pin_mode_min(dir); |
| 600 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 601 | return 0; |
| 602 | } |
| 603 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 604 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 605 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 606 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 607 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 608 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 609 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 610 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 611 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 612 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 613 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 614 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 615 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 616 | /* Find enumerated value for current pinctl setting */ |
| 617 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 618 | 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] | 619 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 620 | *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] | 621 | return 0; |
| 622 | } |
| 623 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 624 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 625 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 626 | { |
| 627 | signed int change; |
| 628 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 629 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 630 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 631 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 632 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 633 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 634 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 635 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 636 | 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] | 637 | val = alc_pin_mode_min(dir); |
| 638 | |
| 639 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 640 | if (change) { |
| 641 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 642 | snd_hda_codec_write_cache(codec, nid, 0, |
| 643 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 644 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 645 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 646 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 647 | * for the requested pin mode. Enum values of 2 or less are |
| 648 | * input modes. |
| 649 | * |
| 650 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 651 | * reduces noise slightly (particularly on input) so we'll |
| 652 | * do it. However, having both input and output buffers |
| 653 | * enabled simultaneously doesn't seem to be problematic if |
| 654 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 655 | */ |
| 656 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 657 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 658 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 659 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 660 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 661 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 662 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 663 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 664 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 665 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 666 | } |
| 667 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 668 | return change; |
| 669 | } |
| 670 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 671 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 672 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 673 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 674 | .info = alc_pin_mode_info, \ |
| 675 | .get = alc_pin_mode_get, \ |
| 676 | .put = alc_pin_mode_put, \ |
| 677 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 678 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 679 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 680 | * together using a mask with more than one bit set. This control is |
| 681 | * currently used only by the ALC260 test model. At this stage they are not |
| 682 | * needed for any "production" models. |
| 683 | */ |
| 684 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 685 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 686 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 687 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 688 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 689 | { |
| 690 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 691 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 692 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 693 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 694 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 695 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 696 | |
| 697 | *valp = (val & mask) != 0; |
| 698 | return 0; |
| 699 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 700 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 701 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 702 | { |
| 703 | signed int change; |
| 704 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 705 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 706 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 707 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 708 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 709 | AC_VERB_GET_GPIO_DATA, |
| 710 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 711 | |
| 712 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 713 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 714 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 715 | gpio_data &= ~mask; |
| 716 | else |
| 717 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 718 | snd_hda_codec_write_cache(codec, nid, 0, |
| 719 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 720 | |
| 721 | return change; |
| 722 | } |
| 723 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 724 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 725 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 726 | .info = alc_gpio_data_info, \ |
| 727 | .get = alc_gpio_data_get, \ |
| 728 | .put = alc_gpio_data_put, \ |
| 729 | .private_value = nid | (mask<<16) } |
| 730 | #endif /* CONFIG_SND_DEBUG */ |
| 731 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 732 | /* A switch control to allow the enabling of the digital IO pins on the |
| 733 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 734 | * to provide something in the test model allowing digital outputs to be |
| 735 | * identified if present. If models are found which can utilise these |
| 736 | * outputs a more complete mixer control can be devised for those models if |
| 737 | * necessary. |
| 738 | */ |
| 739 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 740 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 741 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 742 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 743 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 744 | { |
| 745 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 746 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 747 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 748 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 749 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 750 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 751 | |
| 752 | *valp = (val & mask) != 0; |
| 753 | return 0; |
| 754 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 755 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 756 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 757 | { |
| 758 | signed int change; |
| 759 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 760 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 761 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 762 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 763 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 764 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 765 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 766 | |
| 767 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 768 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 769 | if (val==0) |
| 770 | ctrl_data &= ~mask; |
| 771 | else |
| 772 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 773 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 774 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 775 | |
| 776 | return change; |
| 777 | } |
| 778 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 779 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 780 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 781 | .info = alc_spdif_ctrl_info, \ |
| 782 | .get = alc_spdif_ctrl_get, \ |
| 783 | .put = alc_spdif_ctrl_put, \ |
| 784 | .private_value = nid | (mask<<16) } |
| 785 | #endif /* CONFIG_SND_DEBUG */ |
| 786 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 787 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 788 | * Again, this is only used in the ALC26x test models to help identify when |
| 789 | * the EAPD line must be asserted for features to work. |
| 790 | */ |
| 791 | #ifdef CONFIG_SND_DEBUG |
| 792 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 793 | |
| 794 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 795 | struct snd_ctl_elem_value *ucontrol) |
| 796 | { |
| 797 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 798 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 799 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 800 | long *valp = ucontrol->value.integer.value; |
| 801 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 802 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 803 | |
| 804 | *valp = (val & mask) != 0; |
| 805 | return 0; |
| 806 | } |
| 807 | |
| 808 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 809 | struct snd_ctl_elem_value *ucontrol) |
| 810 | { |
| 811 | int change; |
| 812 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 813 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 814 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 815 | long val = *ucontrol->value.integer.value; |
| 816 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 817 | AC_VERB_GET_EAPD_BTLENABLE, |
| 818 | 0x00); |
| 819 | |
| 820 | /* Set/unset the masked control bit(s) as needed */ |
| 821 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 822 | if (!val) |
| 823 | ctrl_data &= ~mask; |
| 824 | else |
| 825 | ctrl_data |= mask; |
| 826 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 827 | ctrl_data); |
| 828 | |
| 829 | return change; |
| 830 | } |
| 831 | |
| 832 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 833 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 834 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 835 | .info = alc_eapd_ctrl_info, \ |
| 836 | .get = alc_eapd_ctrl_get, \ |
| 837 | .put = alc_eapd_ctrl_put, \ |
| 838 | .private_value = nid | (mask<<16) } |
| 839 | #endif /* CONFIG_SND_DEBUG */ |
| 840 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 841 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 842 | * set up the input pin config (depending on the given auto-pin type) |
| 843 | */ |
| 844 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 845 | int auto_pin_type) |
| 846 | { |
| 847 | unsigned int val = PIN_IN; |
| 848 | |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame^] | 849 | if (auto_pin_type == AUTO_PIN_MIC) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 850 | unsigned int pincap; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 851 | unsigned int oldval; |
| 852 | oldval = snd_hda_codec_read(codec, nid, 0, |
| 853 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 854 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 855 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 856 | /* if the default pin setup is vref50, we give it priority */ |
| 857 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 858 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 859 | else if (pincap & AC_PINCAP_VREF_50) |
| 860 | val = PIN_VREF50; |
| 861 | else if (pincap & AC_PINCAP_VREF_100) |
| 862 | val = PIN_VREF100; |
| 863 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 864 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 865 | } |
| 866 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 867 | } |
| 868 | |
| 869 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 870 | */ |
| 871 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 872 | { |
| 873 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 874 | return; |
| 875 | spec->mixers[spec->num_mixers++] = mix; |
| 876 | } |
| 877 | |
| 878 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 879 | { |
| 880 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 881 | return; |
| 882 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 883 | } |
| 884 | |
| 885 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 886 | * set up from the preset table |
| 887 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 888 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 889 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 890 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 891 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 892 | int i; |
| 893 | |
| 894 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 895 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 896 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 897 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 898 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 899 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 900 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 901 | spec->channel_mode = preset->channel_mode; |
| 902 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 903 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 904 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 905 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 906 | if (preset->const_channel_count) |
| 907 | spec->multiout.max_channels = preset->const_channel_count; |
| 908 | else |
| 909 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 910 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 911 | |
| 912 | spec->multiout.num_dacs = preset->num_dacs; |
| 913 | spec->multiout.dac_nids = preset->dac_nids; |
| 914 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 915 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 916 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 917 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 918 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 919 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 920 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 921 | spec->input_mux = preset->input_mux; |
| 922 | |
| 923 | spec->num_adc_nids = preset->num_adc_nids; |
| 924 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 925 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 926 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 927 | |
| 928 | spec->unsol_event = preset->unsol_event; |
| 929 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 930 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 931 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 932 | spec->loopback.amplist = preset->loopbacks; |
| 933 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 934 | |
| 935 | if (preset->setup) |
| 936 | preset->setup(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 937 | } |
| 938 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 939 | /* Enable GPIO mask and set output */ |
| 940 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 941 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 942 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 943 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 944 | { } |
| 945 | }; |
| 946 | |
| 947 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 948 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 949 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 950 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 951 | { } |
| 952 | }; |
| 953 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 954 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 955 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 956 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 957 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 958 | { } |
| 959 | }; |
| 960 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 961 | /* |
| 962 | * Fix hardware PLL issue |
| 963 | * On some codecs, the analog PLL gating control must be off while |
| 964 | * the default value is 1. |
| 965 | */ |
| 966 | static void alc_fix_pll(struct hda_codec *codec) |
| 967 | { |
| 968 | struct alc_spec *spec = codec->spec; |
| 969 | unsigned int val; |
| 970 | |
| 971 | if (!spec->pll_nid) |
| 972 | return; |
| 973 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 974 | spec->pll_coef_idx); |
| 975 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 976 | AC_VERB_GET_PROC_COEF, 0); |
| 977 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 978 | spec->pll_coef_idx); |
| 979 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 980 | val & ~(1 << spec->pll_coef_bit)); |
| 981 | } |
| 982 | |
| 983 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 984 | unsigned int coef_idx, unsigned int coef_bit) |
| 985 | { |
| 986 | struct alc_spec *spec = codec->spec; |
| 987 | spec->pll_nid = nid; |
| 988 | spec->pll_coef_idx = coef_idx; |
| 989 | spec->pll_coef_bit = coef_bit; |
| 990 | alc_fix_pll(codec); |
| 991 | } |
| 992 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 993 | static void alc_automute_speaker(struct hda_codec *codec, int pinctl) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 994 | { |
| 995 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 996 | unsigned int mute; |
| 997 | hda_nid_t nid; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 998 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 999 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1000 | spec->jack_present = 0; |
| 1001 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1002 | nid = spec->autocfg.hp_pins[i]; |
| 1003 | if (!nid) |
| 1004 | break; |
| 1005 | if (snd_hda_jack_detect(codec, nid)) { |
| 1006 | spec->jack_present = 1; |
| 1007 | break; |
| 1008 | } |
| 1009 | } |
| 1010 | |
| 1011 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
| 1012 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1013 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1014 | nid = spec->autocfg.speaker_pins[i]; |
| 1015 | if (!nid) |
| 1016 | break; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1017 | if (pinctl) { |
| 1018 | snd_hda_codec_write(codec, nid, 0, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1019 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1020 | spec->jack_present ? 0 : PIN_OUT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1021 | } else { |
| 1022 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1023 | HDA_AMP_MUTE, mute); |
| 1024 | } |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1025 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1026 | } |
| 1027 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1028 | static void alc_automute_pin(struct hda_codec *codec) |
| 1029 | { |
| 1030 | alc_automute_speaker(codec, 1); |
| 1031 | } |
| 1032 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1033 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 1034 | hda_nid_t nid) |
| 1035 | { |
| 1036 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 1037 | int i, nums; |
| 1038 | |
| 1039 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1040 | for (i = 0; i < nums; i++) |
| 1041 | if (conn[i] == nid) |
| 1042 | return i; |
| 1043 | return -1; |
| 1044 | } |
| 1045 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1046 | /* switch the current ADC according to the jack state */ |
| 1047 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1048 | { |
| 1049 | struct alc_spec *spec = codec->spec; |
| 1050 | unsigned int present; |
| 1051 | hda_nid_t new_adc; |
| 1052 | |
| 1053 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1054 | if (present) |
| 1055 | spec->cur_adc_idx = 1; |
| 1056 | else |
| 1057 | spec->cur_adc_idx = 0; |
| 1058 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1059 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1060 | /* stream is running, let's swap the current ADC */ |
Takashi Iwai | f0cea79 | 2010-08-13 11:56:53 +0200 | [diff] [blame] | 1061 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1062 | spec->cur_adc = new_adc; |
| 1063 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1064 | spec->cur_adc_stream_tag, 0, |
| 1065 | spec->cur_adc_format); |
| 1066 | } |
| 1067 | } |
| 1068 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1069 | static void alc_mic_automute(struct hda_codec *codec) |
| 1070 | { |
| 1071 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1072 | struct alc_mic_route *dead, *alive; |
| 1073 | unsigned int present, type; |
| 1074 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1075 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1076 | if (!spec->auto_mic) |
| 1077 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1078 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1079 | return; |
| 1080 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1081 | return; |
| 1082 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1083 | if (spec->dual_adc_switch) { |
| 1084 | alc_dual_mic_adc_auto_switch(codec); |
| 1085 | return; |
| 1086 | } |
| 1087 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1088 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1089 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1090 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1091 | if (present) { |
| 1092 | alive = &spec->ext_mic; |
| 1093 | dead = &spec->int_mic; |
| 1094 | } else { |
| 1095 | alive = &spec->int_mic; |
| 1096 | dead = &spec->ext_mic; |
| 1097 | } |
| 1098 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1099 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1100 | if (type == AC_WID_AUD_MIX) { |
| 1101 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1102 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1103 | alive->mux_idx, |
| 1104 | HDA_AMP_MUTE, 0); |
| 1105 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1106 | dead->mux_idx, |
| 1107 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1108 | } else { |
| 1109 | /* MUX style (e.g. ALC880) */ |
| 1110 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1111 | AC_VERB_SET_CONNECT_SEL, |
| 1112 | alive->mux_idx); |
| 1113 | } |
| 1114 | |
| 1115 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1116 | } |
| 1117 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1118 | /* unsolicited event for HP jack sensing */ |
| 1119 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1120 | { |
| 1121 | if (codec->vendor_id == 0x10ec0880) |
| 1122 | res >>= 28; |
| 1123 | else |
| 1124 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1125 | switch (res) { |
| 1126 | case ALC880_HP_EVENT: |
| 1127 | alc_automute_pin(codec); |
| 1128 | break; |
| 1129 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1130 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1131 | break; |
| 1132 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1133 | } |
| 1134 | |
| 1135 | static void alc_inithook(struct hda_codec *codec) |
| 1136 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1137 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1138 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1139 | } |
| 1140 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1141 | /* additional initialization for ALC888 variants */ |
| 1142 | static void alc888_coef_init(struct hda_codec *codec) |
| 1143 | { |
| 1144 | unsigned int tmp; |
| 1145 | |
| 1146 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1147 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1148 | 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] | 1149 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1150 | /* alc888S-VC */ |
| 1151 | snd_hda_codec_read(codec, 0x20, 0, |
| 1152 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1153 | else |
| 1154 | /* alc888-VB */ |
| 1155 | snd_hda_codec_read(codec, 0x20, 0, |
| 1156 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1157 | } |
| 1158 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1159 | static void alc889_coef_init(struct hda_codec *codec) |
| 1160 | { |
| 1161 | unsigned int tmp; |
| 1162 | |
| 1163 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1164 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1165 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1166 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1167 | } |
| 1168 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1169 | /* turn on/off EAPD control (only if available) */ |
| 1170 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1171 | { |
| 1172 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1173 | return; |
| 1174 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1175 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1176 | on ? 2 : 0); |
| 1177 | } |
| 1178 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1179 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1180 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1181 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1182 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1183 | switch (type) { |
| 1184 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1185 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1186 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1187 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1188 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1189 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1190 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1191 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1192 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1193 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1194 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1195 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1196 | set_eapd(codec, 0x0f, 1); |
| 1197 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1198 | break; |
| 1199 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1200 | case 0x10ec0267: |
| 1201 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1202 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1203 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1204 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1205 | case 0x10ec0660: |
| 1206 | case 0x10ec0662: |
| 1207 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1208 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1209 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1210 | set_eapd(codec, 0x14, 1); |
| 1211 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1212 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1213 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1214 | switch (codec->vendor_id) { |
| 1215 | case 0x10ec0260: |
| 1216 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1217 | AC_VERB_SET_COEF_INDEX, 7); |
| 1218 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1219 | AC_VERB_GET_PROC_COEF, 0); |
| 1220 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1221 | AC_VERB_SET_COEF_INDEX, 7); |
| 1222 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1223 | AC_VERB_SET_PROC_COEF, |
| 1224 | tmp | 0x2010); |
| 1225 | break; |
| 1226 | case 0x10ec0262: |
| 1227 | case 0x10ec0880: |
| 1228 | case 0x10ec0882: |
| 1229 | case 0x10ec0883: |
| 1230 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1231 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1232 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1233 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1234 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1235 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1236 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1237 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1238 | #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] | 1239 | case 0x10ec0267: |
| 1240 | case 0x10ec0268: |
| 1241 | snd_hda_codec_write(codec, 0x20, 0, |
| 1242 | AC_VERB_SET_COEF_INDEX, 7); |
| 1243 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1244 | AC_VERB_GET_PROC_COEF, 0); |
| 1245 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1246 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1247 | snd_hda_codec_write(codec, 0x20, 0, |
| 1248 | AC_VERB_SET_PROC_COEF, |
| 1249 | tmp | 0x3000); |
| 1250 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1251 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1252 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1253 | break; |
| 1254 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1255 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1256 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1257 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1258 | { |
| 1259 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1260 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1261 | int i; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1262 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1263 | if (!cfg->hp_pins[0]) { |
| 1264 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1265 | return; |
| 1266 | } |
| 1267 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1268 | if (!cfg->speaker_pins[0]) { |
| 1269 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) |
| 1270 | return; |
| 1271 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
| 1272 | sizeof(cfg->speaker_pins)); |
| 1273 | cfg->speaker_outs = cfg->line_outs; |
| 1274 | } |
| 1275 | |
| 1276 | if (!cfg->hp_pins[0]) { |
| 1277 | memcpy(cfg->hp_pins, cfg->line_out_pins, |
| 1278 | sizeof(cfg->hp_pins)); |
| 1279 | cfg->hp_outs = cfg->line_outs; |
| 1280 | } |
| 1281 | |
| 1282 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1283 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1284 | cfg->hp_pins[i]); |
| 1285 | snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0, |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1286 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1287 | AC_USRSP_EN | ALC880_HP_EVENT); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1288 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1289 | spec->unsol_event = alc_sku_unsol_event; |
| 1290 | } |
| 1291 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1292 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1293 | { |
| 1294 | struct alc_spec *spec = codec->spec; |
| 1295 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1296 | hda_nid_t fixed, ext; |
| 1297 | int i; |
| 1298 | |
| 1299 | /* there must be only two mic inputs exclusively */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1300 | for (i = 0; i < cfg->num_inputs; i++) |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame^] | 1301 | if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN) |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1302 | return; |
| 1303 | |
| 1304 | fixed = ext = 0; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1305 | for (i = 0; i < cfg->num_inputs; i++) { |
| 1306 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1307 | unsigned int defcfg; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1308 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1309 | switch (get_defcfg_connect(defcfg)) { |
| 1310 | case AC_JACK_PORT_FIXED: |
| 1311 | if (fixed) |
| 1312 | return; /* already occupied */ |
| 1313 | fixed = nid; |
| 1314 | break; |
| 1315 | case AC_JACK_PORT_COMPLEX: |
| 1316 | if (ext) |
| 1317 | return; /* already occupied */ |
| 1318 | ext = nid; |
| 1319 | break; |
| 1320 | default: |
| 1321 | return; /* invalid entry */ |
| 1322 | } |
| 1323 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1324 | if (!ext || !fixed) |
| 1325 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1326 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1327 | return; /* no unsol support */ |
| 1328 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1329 | ext, fixed); |
| 1330 | spec->ext_mic.pin = ext; |
| 1331 | spec->int_mic.pin = fixed; |
| 1332 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1333 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1334 | spec->auto_mic = 1; |
| 1335 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1336 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1337 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1338 | spec->unsol_event = alc_sku_unsol_event; |
| 1339 | } |
| 1340 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1341 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1342 | { |
| 1343 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1344 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1345 | struct alc_spec *spec = codec->spec; |
| 1346 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1347 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1348 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1349 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1350 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1351 | goto do_sku; |
| 1352 | |
| 1353 | nid = 0x1d; |
| 1354 | if (codec->vendor_id == 0x10ec0260) |
| 1355 | nid = 0x17; |
| 1356 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1357 | |
| 1358 | if (!(ass & 1)) { |
| 1359 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1360 | codec->chip_name, ass); |
| 1361 | return -1; |
| 1362 | } |
| 1363 | |
| 1364 | /* check sum */ |
| 1365 | tmp = 0; |
| 1366 | for (i = 1; i < 16; i++) { |
| 1367 | if ((ass >> i) & 1) |
| 1368 | tmp++; |
| 1369 | } |
| 1370 | if (((ass >> 16) & 0xf) != tmp) |
| 1371 | return -1; |
| 1372 | |
| 1373 | spec->cdefine.port_connectivity = ass >> 30; |
| 1374 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1375 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1376 | spec->cdefine.customization = ass >> 8; |
| 1377 | do_sku: |
| 1378 | spec->cdefine.sku_cfg = ass; |
| 1379 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1380 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1381 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1382 | spec->cdefine.override = ass & 0x1; |
| 1383 | |
| 1384 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1385 | nid, spec->cdefine.sku_cfg); |
| 1386 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1387 | spec->cdefine.port_connectivity); |
| 1388 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1389 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1390 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1391 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1392 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1393 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1394 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1395 | |
| 1396 | return 0; |
| 1397 | } |
| 1398 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1399 | /* check subsystem ID and set up device-specific initialization; |
| 1400 | * return 1 if initialized, 0 if invalid SSID |
| 1401 | */ |
| 1402 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1403 | * 31 ~ 16 : Manufacture ID |
| 1404 | * 15 ~ 8 : SKU ID |
| 1405 | * 7 ~ 0 : Assembly ID |
| 1406 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1407 | */ |
| 1408 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1409 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1410 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1411 | { |
| 1412 | unsigned int ass, tmp, i; |
| 1413 | unsigned nid; |
| 1414 | struct alc_spec *spec = codec->spec; |
| 1415 | |
| 1416 | ass = codec->subsystem_id & 0xffff; |
| 1417 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1418 | goto do_sku; |
| 1419 | |
| 1420 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1421 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1422 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1423 | * 29~21 : reserve |
| 1424 | * 20 : PCBEEP input |
| 1425 | * 19~16 : Check sum (15:1) |
| 1426 | * 15~1 : Custom |
| 1427 | * 0 : override |
| 1428 | */ |
| 1429 | nid = 0x1d; |
| 1430 | if (codec->vendor_id == 0x10ec0260) |
| 1431 | nid = 0x17; |
| 1432 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1433 | snd_printd("realtek: No valid SSID, " |
| 1434 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1435 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1436 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1437 | return 0; |
| 1438 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1439 | return 0; |
| 1440 | |
| 1441 | /* check sum */ |
| 1442 | tmp = 0; |
| 1443 | for (i = 1; i < 16; i++) { |
| 1444 | if ((ass >> i) & 1) |
| 1445 | tmp++; |
| 1446 | } |
| 1447 | if (((ass >> 16) & 0xf) != tmp) |
| 1448 | return 0; |
| 1449 | do_sku: |
| 1450 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1451 | ass & 0xffff, codec->vendor_id); |
| 1452 | /* |
| 1453 | * 0 : override |
| 1454 | * 1 : Swap Jack |
| 1455 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1456 | * 3~5 : External Amplifier control |
| 1457 | * 7~6 : Reserved |
| 1458 | */ |
| 1459 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1460 | switch (tmp) { |
| 1461 | case 1: |
| 1462 | spec->init_amp = ALC_INIT_GPIO1; |
| 1463 | break; |
| 1464 | case 3: |
| 1465 | spec->init_amp = ALC_INIT_GPIO2; |
| 1466 | break; |
| 1467 | case 7: |
| 1468 | spec->init_amp = ALC_INIT_GPIO3; |
| 1469 | break; |
| 1470 | case 5: |
| 1471 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1472 | break; |
| 1473 | } |
| 1474 | |
| 1475 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1476 | * when the external headphone out jack is plugged" |
| 1477 | */ |
| 1478 | if (!(ass & 0x8000)) |
| 1479 | return 1; |
| 1480 | /* |
| 1481 | * 10~8 : Jack location |
| 1482 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1483 | * 14~13: Resvered |
| 1484 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1485 | * when the external headphone out jack is plugged" |
| 1486 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1487 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1488 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1489 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1490 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1491 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1492 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1493 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1494 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1495 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1496 | else if (tmp == 3) |
| 1497 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1498 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1499 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1500 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1501 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1502 | return 1; |
| 1503 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1504 | } |
| 1505 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1506 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1507 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1508 | return 1; |
| 1509 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1510 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1511 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1512 | hda_nid_t porta, hda_nid_t porte, |
| 1513 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1514 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1515 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1516 | struct alc_spec *spec = codec->spec; |
| 1517 | snd_printd("realtek: " |
| 1518 | "Enable default setup for auto mode as fallback\n"); |
| 1519 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1520 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1521 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1522 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1523 | } |
| 1524 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1525 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1526 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1527 | */ |
| 1528 | |
| 1529 | struct alc_pincfg { |
| 1530 | hda_nid_t nid; |
| 1531 | u32 val; |
| 1532 | }; |
| 1533 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1534 | struct alc_fixup { |
| 1535 | const struct alc_pincfg *pins; |
| 1536 | const struct hda_verb *verbs; |
| 1537 | }; |
| 1538 | |
| 1539 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1540 | const struct snd_pci_quirk *quirk, |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1541 | const struct alc_fixup *fix, |
| 1542 | int pre_init) |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1543 | { |
| 1544 | const struct alc_pincfg *cfg; |
| 1545 | |
| 1546 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1547 | if (!quirk) |
| 1548 | return; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1549 | fix += quirk->value; |
| 1550 | cfg = fix->pins; |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1551 | if (pre_init && cfg) { |
| 1552 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1553 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", |
| 1554 | codec->chip_name, quirk->name); |
| 1555 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1556 | for (; cfg->nid; cfg++) |
| 1557 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
| 1558 | } |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1559 | if (!pre_init && fix->verbs) { |
| 1560 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1561 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", |
| 1562 | codec->chip_name, quirk->name); |
| 1563 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1564 | add_verb(codec->spec, fix->verbs); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1565 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1566 | } |
| 1567 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1568 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1569 | unsigned int coef_idx) |
| 1570 | { |
| 1571 | unsigned int val; |
| 1572 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1573 | coef_idx); |
| 1574 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1575 | AC_VERB_GET_PROC_COEF, 0); |
| 1576 | return val; |
| 1577 | } |
| 1578 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1579 | /* set right pin controls for digital I/O */ |
| 1580 | static void alc_auto_init_digital(struct hda_codec *codec) |
| 1581 | { |
| 1582 | struct alc_spec *spec = codec->spec; |
| 1583 | int i; |
| 1584 | hda_nid_t pin; |
| 1585 | |
| 1586 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1587 | pin = spec->autocfg.dig_out_pins[i]; |
| 1588 | if (pin) { |
| 1589 | snd_hda_codec_write(codec, pin, 0, |
| 1590 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1591 | PIN_OUT); |
| 1592 | } |
| 1593 | } |
| 1594 | pin = spec->autocfg.dig_in_pin; |
| 1595 | if (pin) |
| 1596 | snd_hda_codec_write(codec, pin, 0, |
| 1597 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1598 | PIN_IN); |
| 1599 | } |
| 1600 | |
| 1601 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ |
| 1602 | static void alc_auto_parse_digital(struct hda_codec *codec) |
| 1603 | { |
| 1604 | struct alc_spec *spec = codec->spec; |
| 1605 | int i, err; |
| 1606 | hda_nid_t dig_nid; |
| 1607 | |
| 1608 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
| 1609 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1610 | err = snd_hda_get_connections(codec, |
| 1611 | spec->autocfg.dig_out_pins[i], |
| 1612 | &dig_nid, 1); |
| 1613 | if (err < 0) |
| 1614 | continue; |
| 1615 | if (!i) { |
| 1616 | spec->multiout.dig_out_nid = dig_nid; |
| 1617 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 1618 | } else { |
| 1619 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 1620 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 1621 | break; |
| 1622 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 1623 | } |
| 1624 | } |
| 1625 | |
| 1626 | if (spec->autocfg.dig_in_pin) { |
| 1627 | hda_nid_t dig_nid; |
| 1628 | err = snd_hda_get_connections(codec, |
| 1629 | spec->autocfg.dig_in_pin, |
| 1630 | &dig_nid, 1); |
| 1631 | if (err > 0) |
| 1632 | spec->dig_in_nid = dig_nid; |
| 1633 | } |
| 1634 | } |
| 1635 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1636 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1637 | * ALC888 |
| 1638 | */ |
| 1639 | |
| 1640 | /* |
| 1641 | * 2ch mode |
| 1642 | */ |
| 1643 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1644 | /* Mic-in jack as mic in */ |
| 1645 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1646 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1647 | /* Line-in jack as Line in */ |
| 1648 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1649 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1650 | /* Line-Out as Front */ |
| 1651 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1652 | { } /* end */ |
| 1653 | }; |
| 1654 | |
| 1655 | /* |
| 1656 | * 4ch mode |
| 1657 | */ |
| 1658 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1659 | /* Mic-in jack as mic in */ |
| 1660 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1661 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1662 | /* Line-in jack as Surround */ |
| 1663 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1664 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1665 | /* Line-Out as Front */ |
| 1666 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1667 | { } /* end */ |
| 1668 | }; |
| 1669 | |
| 1670 | /* |
| 1671 | * 6ch mode |
| 1672 | */ |
| 1673 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1674 | /* Mic-in jack as CLFE */ |
| 1675 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1676 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1677 | /* Line-in jack as Surround */ |
| 1678 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1679 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1680 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1681 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1682 | { } /* end */ |
| 1683 | }; |
| 1684 | |
| 1685 | /* |
| 1686 | * 8ch mode |
| 1687 | */ |
| 1688 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1689 | /* Mic-in jack as CLFE */ |
| 1690 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1691 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1692 | /* Line-in jack as Surround */ |
| 1693 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1694 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1695 | /* Line-Out as Side */ |
| 1696 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1697 | { } /* end */ |
| 1698 | }; |
| 1699 | |
| 1700 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1701 | { 2, alc888_4ST_ch2_intel_init }, |
| 1702 | { 4, alc888_4ST_ch4_intel_init }, |
| 1703 | { 6, alc888_4ST_ch6_intel_init }, |
| 1704 | { 8, alc888_4ST_ch8_intel_init }, |
| 1705 | }; |
| 1706 | |
| 1707 | /* |
| 1708 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1709 | */ |
| 1710 | |
| 1711 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1712 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1713 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1714 | /* Connect Internal HP to Front */ |
| 1715 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1716 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1717 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1718 | /* Connect Bass HP to Front */ |
| 1719 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1720 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1721 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1722 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1723 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1724 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1725 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1726 | /* Connect Mic jack to CLFE */ |
| 1727 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1728 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1729 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1730 | /* Connect Line-in jack to Surround */ |
| 1731 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1732 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1733 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1734 | /* Connect HP out jack to Front */ |
| 1735 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1736 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1737 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1738 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1739 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1740 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1741 | {} |
| 1742 | }; |
| 1743 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1744 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1745 | { |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1746 | alc_automute_speaker(codec, 0); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1747 | } |
| 1748 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1749 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1750 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1751 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1752 | if (codec->vendor_id == 0x10ec0880) |
| 1753 | res >>= 28; |
| 1754 | else |
| 1755 | res >>= 26; |
| 1756 | if (res == ALC880_HP_EVENT) |
| 1757 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1758 | } |
| 1759 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1760 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1761 | { |
| 1762 | struct alc_spec *spec = codec->spec; |
| 1763 | |
| 1764 | spec->autocfg.hp_pins[0] = 0x15; |
| 1765 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1766 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1767 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1768 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1769 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1770 | } |
| 1771 | |
| 1772 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1773 | { |
| 1774 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1775 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1776 | } |
| 1777 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1778 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1779 | { |
| 1780 | struct alc_spec *spec = codec->spec; |
| 1781 | |
| 1782 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1783 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1784 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1785 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1786 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1787 | |
| 1788 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1789 | * ALC888 Acer Aspire 4930G model |
| 1790 | */ |
| 1791 | |
| 1792 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1793 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1794 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1795 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1796 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1797 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1798 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1799 | /* Connect Internal HP to front */ |
| 1800 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1801 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1802 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1803 | /* Connect HP out to front */ |
| 1804 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1805 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1806 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1807 | { } |
| 1808 | }; |
| 1809 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1810 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1811 | * ALC888 Acer Aspire 6530G model |
| 1812 | */ |
| 1813 | |
| 1814 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1815 | /* Route to built-in subwoofer as well as speakers */ |
| 1816 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1817 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1818 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1819 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1820 | /* Bias voltage on for external mic port */ |
| 1821 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1822 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1823 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1824 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1825 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1826 | /* Enable unsolicited event for HP jack */ |
| 1827 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1828 | /* Enable speaker output */ |
| 1829 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1830 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1831 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1832 | /* Enable headphone output */ |
| 1833 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1834 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1835 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1836 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1837 | { } |
| 1838 | }; |
| 1839 | |
| 1840 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1841 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1842 | */ |
| 1843 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1844 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1845 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1846 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1847 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1848 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1849 | /* Enable unsolicited event for HP jack */ |
| 1850 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1851 | /* Connect Internal Front to Front */ |
| 1852 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1853 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1854 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1855 | /* Connect Internal Rear to Rear */ |
| 1856 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1857 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1858 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1859 | /* Connect Internal CLFE to CLFE */ |
| 1860 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1861 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1862 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1863 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1864 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1865 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1866 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1867 | /* Enable all DACs */ |
| 1868 | /* DAC DISABLE/MUTE 1? */ |
| 1869 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1870 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1871 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1872 | /* DAC DISABLE/MUTE 2? */ |
| 1873 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1874 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1875 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1876 | /* DMIC fix |
| 1877 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1878 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1879 | * makes the signal become a difference/sum signal instead of standard |
| 1880 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1881 | * codec replicate the sum signal to both channels, turning it into a |
| 1882 | * normal mono mic. |
| 1883 | */ |
| 1884 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1885 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1886 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1887 | { } |
| 1888 | }; |
| 1889 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1890 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1891 | /* Front mic only available on one ADC */ |
| 1892 | { |
| 1893 | .num_items = 4, |
| 1894 | .items = { |
| 1895 | { "Mic", 0x0 }, |
| 1896 | { "Line", 0x2 }, |
| 1897 | { "CD", 0x4 }, |
| 1898 | { "Front Mic", 0xb }, |
| 1899 | }, |
| 1900 | }, |
| 1901 | { |
| 1902 | .num_items = 3, |
| 1903 | .items = { |
| 1904 | { "Mic", 0x0 }, |
| 1905 | { "Line", 0x2 }, |
| 1906 | { "CD", 0x4 }, |
| 1907 | }, |
| 1908 | } |
| 1909 | }; |
| 1910 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1911 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1912 | /* Interal mic only available on one ADC */ |
| 1913 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1914 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1915 | .items = { |
| 1916 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1917 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1918 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1919 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1920 | { "Int Mic", 0xb }, |
| 1921 | }, |
| 1922 | }, |
| 1923 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1924 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1925 | .items = { |
| 1926 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1927 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1928 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1929 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1930 | }, |
| 1931 | } |
| 1932 | }; |
| 1933 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1934 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1935 | /* Digital mic only available on first "ADC" */ |
| 1936 | { |
| 1937 | .num_items = 5, |
| 1938 | .items = { |
| 1939 | { "Mic", 0x0 }, |
| 1940 | { "Line", 0x2 }, |
| 1941 | { "CD", 0x4 }, |
| 1942 | { "Front Mic", 0xb }, |
| 1943 | { "Input Mix", 0xa }, |
| 1944 | }, |
| 1945 | }, |
| 1946 | { |
| 1947 | .num_items = 4, |
| 1948 | .items = { |
| 1949 | { "Mic", 0x0 }, |
| 1950 | { "Line", 0x2 }, |
| 1951 | { "CD", 0x4 }, |
| 1952 | { "Input Mix", 0xa }, |
| 1953 | }, |
| 1954 | }, |
| 1955 | { |
| 1956 | .num_items = 4, |
| 1957 | .items = { |
| 1958 | { "Mic", 0x0 }, |
| 1959 | { "Line", 0x2 }, |
| 1960 | { "CD", 0x4 }, |
| 1961 | { "Input Mix", 0xa }, |
| 1962 | }, |
| 1963 | } |
| 1964 | }; |
| 1965 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1966 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1967 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1968 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1969 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1970 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1971 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1972 | HDA_OUTPUT), |
| 1973 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1974 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1975 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1976 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1977 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1978 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1979 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1980 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1981 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1982 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1983 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1984 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1985 | { } /* end */ |
| 1986 | }; |
| 1987 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 1988 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 1989 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1990 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1991 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1992 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1993 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1994 | HDA_OUTPUT), |
| 1995 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1996 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1997 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1998 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1999 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2000 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2001 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 2002 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2003 | { } /* end */ |
| 2004 | }; |
| 2005 | |
| 2006 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2007 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2008 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2009 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2010 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2011 | spec->autocfg.hp_pins[0] = 0x15; |
| 2012 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 2013 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2014 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2015 | } |
| 2016 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2017 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2018 | { |
| 2019 | struct alc_spec *spec = codec->spec; |
| 2020 | |
| 2021 | spec->autocfg.hp_pins[0] = 0x15; |
| 2022 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2023 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2024 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2025 | } |
| 2026 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2027 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2028 | { |
| 2029 | struct alc_spec *spec = codec->spec; |
| 2030 | |
| 2031 | spec->autocfg.hp_pins[0] = 0x15; |
| 2032 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2033 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2034 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2035 | } |
| 2036 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2037 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2038 | * ALC880 3-stack model |
| 2039 | * |
| 2040 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2041 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 2042 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2043 | */ |
| 2044 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2045 | static hda_nid_t alc880_dac_nids[4] = { |
| 2046 | /* front, rear, clfe, rear_surr */ |
| 2047 | 0x02, 0x05, 0x04, 0x03 |
| 2048 | }; |
| 2049 | |
| 2050 | static hda_nid_t alc880_adc_nids[3] = { |
| 2051 | /* ADC0-2 */ |
| 2052 | 0x07, 0x08, 0x09, |
| 2053 | }; |
| 2054 | |
| 2055 | /* The datasheet says the node 0x07 is connected from inputs, |
| 2056 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2057 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2058 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2059 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 2060 | /* ADC1-2 */ |
| 2061 | 0x08, 0x09, |
| 2062 | }; |
| 2063 | |
| 2064 | #define ALC880_DIGOUT_NID 0x06 |
| 2065 | #define ALC880_DIGIN_NID 0x0a |
| 2066 | |
| 2067 | static struct hda_input_mux alc880_capture_source = { |
| 2068 | .num_items = 4, |
| 2069 | .items = { |
| 2070 | { "Mic", 0x0 }, |
| 2071 | { "Front Mic", 0x3 }, |
| 2072 | { "Line", 0x2 }, |
| 2073 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2074 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2075 | }; |
| 2076 | |
| 2077 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2078 | /* 2ch mode */ |
| 2079 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 2080 | /* set line-in to input, mute it */ |
| 2081 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2082 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2083 | /* set mic-in to input vref 80%, mute it */ |
| 2084 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2085 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2086 | { } /* end */ |
| 2087 | }; |
| 2088 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2089 | /* 6ch mode */ |
| 2090 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 2091 | /* set line-in to output, unmute it */ |
| 2092 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2093 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2094 | /* set mic-in to output, unmute it */ |
| 2095 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2096 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2097 | { } /* end */ |
| 2098 | }; |
| 2099 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2100 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2101 | { 2, alc880_threestack_ch2_init }, |
| 2102 | { 6, alc880_threestack_ch6_init }, |
| 2103 | }; |
| 2104 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2105 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2106 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2107 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2108 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2109 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2110 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2111 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2112 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2113 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2114 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2115 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2116 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2117 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2118 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2119 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2120 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2121 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2122 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2123 | { |
| 2124 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2125 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2126 | .info = alc_ch_mode_info, |
| 2127 | .get = alc_ch_mode_get, |
| 2128 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2129 | }, |
| 2130 | { } /* end */ |
| 2131 | }; |
| 2132 | |
| 2133 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2134 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2135 | struct snd_ctl_elem_info *uinfo) |
| 2136 | { |
| 2137 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2138 | struct alc_spec *spec = codec->spec; |
| 2139 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2140 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2141 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2142 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2143 | HDA_INPUT); |
| 2144 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2145 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2146 | return err; |
| 2147 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2148 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2149 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2150 | unsigned int size, unsigned int __user *tlv) |
| 2151 | { |
| 2152 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2153 | struct alc_spec *spec = codec->spec; |
| 2154 | int err; |
| 2155 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2156 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2157 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2158 | HDA_INPUT); |
| 2159 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2160 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2161 | return err; |
| 2162 | } |
| 2163 | |
| 2164 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2165 | struct snd_ctl_elem_value *ucontrol); |
| 2166 | |
| 2167 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2168 | struct snd_ctl_elem_value *ucontrol, |
| 2169 | getput_call_t func) |
| 2170 | { |
| 2171 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2172 | struct alc_spec *spec = codec->spec; |
| 2173 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2174 | int err; |
| 2175 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2176 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2177 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2178 | 3, 0, HDA_INPUT); |
| 2179 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2180 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2181 | return err; |
| 2182 | } |
| 2183 | |
| 2184 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2185 | struct snd_ctl_elem_value *ucontrol) |
| 2186 | { |
| 2187 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2188 | snd_hda_mixer_amp_volume_get); |
| 2189 | } |
| 2190 | |
| 2191 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2192 | struct snd_ctl_elem_value *ucontrol) |
| 2193 | { |
| 2194 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2195 | snd_hda_mixer_amp_volume_put); |
| 2196 | } |
| 2197 | |
| 2198 | /* capture mixer elements */ |
| 2199 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2200 | |
| 2201 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2202 | struct snd_ctl_elem_value *ucontrol) |
| 2203 | { |
| 2204 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2205 | snd_hda_mixer_amp_switch_get); |
| 2206 | } |
| 2207 | |
| 2208 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2209 | struct snd_ctl_elem_value *ucontrol) |
| 2210 | { |
| 2211 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2212 | snd_hda_mixer_amp_switch_put); |
| 2213 | } |
| 2214 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2215 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2216 | { \ |
| 2217 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2218 | .name = "Capture Switch", \ |
| 2219 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2220 | .count = num, \ |
| 2221 | .info = alc_cap_sw_info, \ |
| 2222 | .get = alc_cap_sw_get, \ |
| 2223 | .put = alc_cap_sw_put, \ |
| 2224 | }, \ |
| 2225 | { \ |
| 2226 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2227 | .name = "Capture Volume", \ |
| 2228 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2229 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2230 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2231 | .count = num, \ |
| 2232 | .info = alc_cap_vol_info, \ |
| 2233 | .get = alc_cap_vol_get, \ |
| 2234 | .put = alc_cap_vol_put, \ |
| 2235 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2236 | } |
| 2237 | |
| 2238 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2239 | { \ |
| 2240 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2241 | /* .name = "Capture Source", */ \ |
| 2242 | .name = "Input Source", \ |
| 2243 | .count = num, \ |
| 2244 | .info = alc_mux_enum_info, \ |
| 2245 | .get = alc_mux_enum_get, \ |
| 2246 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2247 | } |
| 2248 | |
| 2249 | #define DEFINE_CAPMIX(num) \ |
| 2250 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2251 | _DEFINE_CAPMIX(num), \ |
| 2252 | _DEFINE_CAPSRC(num), \ |
| 2253 | { } /* end */ \ |
| 2254 | } |
| 2255 | |
| 2256 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2257 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2258 | _DEFINE_CAPMIX(num), \ |
| 2259 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2260 | } |
| 2261 | |
| 2262 | /* up to three ADCs */ |
| 2263 | DEFINE_CAPMIX(1); |
| 2264 | DEFINE_CAPMIX(2); |
| 2265 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2266 | DEFINE_CAPMIX_NOSRC(1); |
| 2267 | DEFINE_CAPMIX_NOSRC(2); |
| 2268 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2269 | |
| 2270 | /* |
| 2271 | * ALC880 5-stack model |
| 2272 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2273 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2274 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2275 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2276 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2277 | */ |
| 2278 | |
| 2279 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2280 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2281 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2282 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2283 | { } /* end */ |
| 2284 | }; |
| 2285 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2286 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2287 | /* 6ch mode */ |
| 2288 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2289 | /* set line-in to input, mute it */ |
| 2290 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2291 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2292 | { } /* end */ |
| 2293 | }; |
| 2294 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2295 | /* 8ch mode */ |
| 2296 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2297 | /* set line-in to output, unmute it */ |
| 2298 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2299 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2300 | { } /* end */ |
| 2301 | }; |
| 2302 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2303 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2304 | { 6, alc880_fivestack_ch6_init }, |
| 2305 | { 8, alc880_fivestack_ch8_init }, |
| 2306 | }; |
| 2307 | |
| 2308 | |
| 2309 | /* |
| 2310 | * ALC880 6-stack model |
| 2311 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2312 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2313 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2314 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2315 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2316 | */ |
| 2317 | |
| 2318 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2319 | /* front, rear, clfe, rear_surr */ |
| 2320 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2321 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2322 | |
| 2323 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2324 | .num_items = 4, |
| 2325 | .items = { |
| 2326 | { "Mic", 0x0 }, |
| 2327 | { "Front Mic", 0x1 }, |
| 2328 | { "Line", 0x2 }, |
| 2329 | { "CD", 0x4 }, |
| 2330 | }, |
| 2331 | }; |
| 2332 | |
| 2333 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2334 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2335 | { 8, NULL }, |
| 2336 | }; |
| 2337 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2338 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2339 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2340 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2341 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2342 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2343 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2344 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2345 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2346 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2347 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2348 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2349 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2350 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2351 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2352 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2353 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2354 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2355 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2356 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2357 | { |
| 2358 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2359 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2360 | .info = alc_ch_mode_info, |
| 2361 | .get = alc_ch_mode_get, |
| 2362 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2363 | }, |
| 2364 | { } /* end */ |
| 2365 | }; |
| 2366 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2367 | |
| 2368 | /* |
| 2369 | * ALC880 W810 model |
| 2370 | * |
| 2371 | * W810 has rear IO for: |
| 2372 | * Front (DAC 02) |
| 2373 | * Surround (DAC 03) |
| 2374 | * Center/LFE (DAC 04) |
| 2375 | * Digital out (06) |
| 2376 | * |
| 2377 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2378 | * 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] | 2379 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2380 | * There is a variable resistor to control the speaker or headphone |
| 2381 | * volume. This is a hardware-only device without a software API. |
| 2382 | * |
| 2383 | * Plugging headphones in will disable the internal speakers. This is |
| 2384 | * implemented in hardware, not via the driver using jack sense. In |
| 2385 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2386 | * disable both the speakers and headphones. |
| 2387 | * |
| 2388 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2389 | * These may not do anything useful with this driver yet, because I |
| 2390 | * haven't setup any initialization verbs for these yet... |
| 2391 | */ |
| 2392 | |
| 2393 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2394 | /* front, rear/surround, clfe */ |
| 2395 | 0x02, 0x03, 0x04 |
| 2396 | }; |
| 2397 | |
| 2398 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2399 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2400 | { 6, NULL } |
| 2401 | }; |
| 2402 | |
| 2403 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2404 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2405 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2406 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2407 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2408 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2409 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2410 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2411 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2412 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2413 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2414 | { } /* end */ |
| 2415 | }; |
| 2416 | |
| 2417 | |
| 2418 | /* |
| 2419 | * Z710V model |
| 2420 | * |
| 2421 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2422 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2423 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2424 | */ |
| 2425 | |
| 2426 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2427 | 0x02 |
| 2428 | }; |
| 2429 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2430 | |
| 2431 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2432 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2433 | { 2, NULL } |
| 2434 | }; |
| 2435 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2436 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2437 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2438 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2439 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2440 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2441 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2442 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2443 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2444 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2445 | { } /* end */ |
| 2446 | }; |
| 2447 | |
| 2448 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2449 | /* |
| 2450 | * ALC880 F1734 model |
| 2451 | * |
| 2452 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2453 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2454 | */ |
| 2455 | |
| 2456 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2457 | 0x03 |
| 2458 | }; |
| 2459 | #define ALC880_F1734_HP_DAC 0x02 |
| 2460 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2461 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2462 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2463 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2464 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2465 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2466 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2467 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2468 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2469 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2470 | { } /* end */ |
| 2471 | }; |
| 2472 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2473 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2474 | .num_items = 2, |
| 2475 | .items = { |
| 2476 | { "Mic", 0x1 }, |
| 2477 | { "CD", 0x4 }, |
| 2478 | }, |
| 2479 | }; |
| 2480 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2481 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2482 | /* |
| 2483 | * ALC880 ASUS model |
| 2484 | * |
| 2485 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2486 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2487 | * Mic = 0x18, Line = 0x1a |
| 2488 | */ |
| 2489 | |
| 2490 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2491 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2492 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2493 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2494 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2495 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2496 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2497 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2498 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2499 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2500 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2501 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2502 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2503 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2504 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2505 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2506 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2507 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2508 | { |
| 2509 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2510 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2511 | .info = alc_ch_mode_info, |
| 2512 | .get = alc_ch_mode_get, |
| 2513 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2514 | }, |
| 2515 | { } /* end */ |
| 2516 | }; |
| 2517 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2518 | /* |
| 2519 | * ALC880 ASUS W1V model |
| 2520 | * |
| 2521 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2522 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2523 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2524 | */ |
| 2525 | |
| 2526 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2527 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2528 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2529 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2530 | { } /* end */ |
| 2531 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2532 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2533 | /* TCL S700 */ |
| 2534 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2535 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2536 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2537 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2538 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2539 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2540 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2541 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2542 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2543 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2544 | { } /* end */ |
| 2545 | }; |
| 2546 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2547 | /* Uniwill */ |
| 2548 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2549 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2550 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2551 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2552 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2553 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2554 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2555 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2556 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2557 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2558 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2559 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2560 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2561 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2562 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2563 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2564 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2565 | { |
| 2566 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2567 | .name = "Channel Mode", |
| 2568 | .info = alc_ch_mode_info, |
| 2569 | .get = alc_ch_mode_get, |
| 2570 | .put = alc_ch_mode_put, |
| 2571 | }, |
| 2572 | { } /* end */ |
| 2573 | }; |
| 2574 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2575 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2576 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2577 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2578 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2579 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2580 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2581 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2582 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2583 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2584 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2585 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2586 | { } /* end */ |
| 2587 | }; |
| 2588 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2589 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2590 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2591 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2592 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2593 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2594 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2595 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2596 | { } /* end */ |
| 2597 | }; |
| 2598 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2599 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2600 | * virtual master controls |
| 2601 | */ |
| 2602 | |
| 2603 | /* |
| 2604 | * slave controls for virtual master |
| 2605 | */ |
| 2606 | static const char *alc_slave_vols[] = { |
| 2607 | "Front Playback Volume", |
| 2608 | "Surround Playback Volume", |
| 2609 | "Center Playback Volume", |
| 2610 | "LFE Playback Volume", |
| 2611 | "Side Playback Volume", |
| 2612 | "Headphone Playback Volume", |
| 2613 | "Speaker Playback Volume", |
| 2614 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2615 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2616 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2617 | NULL, |
| 2618 | }; |
| 2619 | |
| 2620 | static const char *alc_slave_sws[] = { |
| 2621 | "Front Playback Switch", |
| 2622 | "Surround Playback Switch", |
| 2623 | "Center Playback Switch", |
| 2624 | "LFE Playback Switch", |
| 2625 | "Side Playback Switch", |
| 2626 | "Headphone Playback Switch", |
| 2627 | "Speaker Playback Switch", |
| 2628 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2629 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2630 | "Line-Out Playback Switch", |
| 2631 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2632 | NULL, |
| 2633 | }; |
| 2634 | |
| 2635 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2636 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2637 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2638 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2639 | #define NID_MAPPING (-1) |
| 2640 | |
| 2641 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2642 | #define SUBDEV_HP_ (1 << 6) |
| 2643 | #define SUBDEV_LINE_ (2 << 6) |
| 2644 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2645 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2646 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2647 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2648 | static void alc_free_kctls(struct hda_codec *codec); |
| 2649 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2650 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2651 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2652 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2653 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2654 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2655 | { } /* end */ |
| 2656 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2657 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2658 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2659 | static int alc_build_controls(struct hda_codec *codec) |
| 2660 | { |
| 2661 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 2662 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2663 | struct snd_kcontrol_new *knew; |
| 2664 | int i, j, err; |
| 2665 | unsigned int u; |
| 2666 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2667 | |
| 2668 | for (i = 0; i < spec->num_mixers; i++) { |
| 2669 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2670 | if (err < 0) |
| 2671 | return err; |
| 2672 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2673 | if (spec->cap_mixer) { |
| 2674 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2675 | if (err < 0) |
| 2676 | return err; |
| 2677 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2678 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2679 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2680 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2681 | if (err < 0) |
| 2682 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2683 | if (!spec->no_analog) { |
| 2684 | err = snd_hda_create_spdif_share_sw(codec, |
| 2685 | &spec->multiout); |
| 2686 | if (err < 0) |
| 2687 | return err; |
| 2688 | spec->multiout.share_spdif = 1; |
| 2689 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2690 | } |
| 2691 | if (spec->dig_in_nid) { |
| 2692 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2693 | if (err < 0) |
| 2694 | return err; |
| 2695 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2696 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2697 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2698 | /* create beep controls if needed */ |
| 2699 | if (spec->beep_amp) { |
| 2700 | struct snd_kcontrol_new *knew; |
| 2701 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2702 | struct snd_kcontrol *kctl; |
| 2703 | kctl = snd_ctl_new1(knew, codec); |
| 2704 | if (!kctl) |
| 2705 | return -ENOMEM; |
| 2706 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2707 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2708 | if (err < 0) |
| 2709 | return err; |
| 2710 | } |
| 2711 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2712 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2713 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2714 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2715 | if (!spec->no_analog && |
| 2716 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2717 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2718 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2719 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2720 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2721 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2722 | if (err < 0) |
| 2723 | return err; |
| 2724 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2725 | if (!spec->no_analog && |
| 2726 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2727 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2728 | NULL, alc_slave_sws); |
| 2729 | if (err < 0) |
| 2730 | return err; |
| 2731 | } |
| 2732 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2733 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 2734 | if (spec->capsrc_nids || spec->adc_nids) { |
| 2735 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 2736 | if (!kctl) |
| 2737 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 2738 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2739 | hda_nid_t *nids = spec->capsrc_nids; |
| 2740 | if (!nids) |
| 2741 | nids = spec->adc_nids; |
| 2742 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 2743 | if (err < 0) |
| 2744 | return err; |
| 2745 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2746 | } |
| 2747 | if (spec->cap_mixer) { |
| 2748 | const char *kname = kctl ? kctl->id.name : NULL; |
| 2749 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 2750 | if (kname && strcmp(knew->name, kname) == 0) |
| 2751 | continue; |
| 2752 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2753 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2754 | err = snd_hda_add_nid(codec, kctl, i, |
| 2755 | spec->adc_nids[i]); |
| 2756 | if (err < 0) |
| 2757 | return err; |
| 2758 | } |
| 2759 | } |
| 2760 | } |
| 2761 | |
| 2762 | /* other nid->control mapping */ |
| 2763 | for (i = 0; i < spec->num_mixers; i++) { |
| 2764 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 2765 | if (knew->iface != NID_MAPPING) |
| 2766 | continue; |
| 2767 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2768 | if (kctl == NULL) |
| 2769 | continue; |
| 2770 | u = knew->subdevice; |
| 2771 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2772 | nid = u & 0x3f; |
| 2773 | if (nid == 0) |
| 2774 | continue; |
| 2775 | switch (u & 0xc0) { |
| 2776 | case SUBDEV_SPEAKER_: |
| 2777 | nid = spec->autocfg.speaker_pins[nid]; |
| 2778 | break; |
| 2779 | case SUBDEV_LINE_: |
| 2780 | nid = spec->autocfg.line_out_pins[nid]; |
| 2781 | break; |
| 2782 | case SUBDEV_HP_: |
| 2783 | nid = spec->autocfg.hp_pins[nid]; |
| 2784 | break; |
| 2785 | default: |
| 2786 | continue; |
| 2787 | } |
| 2788 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2789 | if (err < 0) |
| 2790 | return err; |
| 2791 | } |
| 2792 | u = knew->private_value; |
| 2793 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2794 | nid = u & 0xff; |
| 2795 | if (nid == 0) |
| 2796 | continue; |
| 2797 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2798 | if (err < 0) |
| 2799 | return err; |
| 2800 | } |
| 2801 | } |
| 2802 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 2803 | |
| 2804 | alc_free_kctls(codec); /* no longer needed */ |
| 2805 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2806 | return 0; |
| 2807 | } |
| 2808 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2809 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2810 | /* |
| 2811 | * initialize the codec volumes, etc |
| 2812 | */ |
| 2813 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2814 | /* |
| 2815 | * generic initialization of ADC, input mixers and output mixers |
| 2816 | */ |
| 2817 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2818 | /* |
| 2819 | * Unmute ADC0-2 and set the default input to mic-in |
| 2820 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2821 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2822 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2823 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2824 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2825 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2826 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2827 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2828 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2829 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2830 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2831 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2832 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2833 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2834 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2835 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2836 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2837 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2838 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2839 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2840 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2841 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2842 | /* |
| 2843 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2844 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2845 | /* set vol=0 to output mixers */ |
| 2846 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2847 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2848 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2849 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2850 | /* set up input amps for analog loopback */ |
| 2851 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2852 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2853 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2854 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2855 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2856 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2857 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2858 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2859 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2860 | |
| 2861 | { } |
| 2862 | }; |
| 2863 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2864 | /* |
| 2865 | * 3-stack pin configuration: |
| 2866 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2867 | */ |
| 2868 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2869 | /* |
| 2870 | * preset connection lists of input pins |
| 2871 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2872 | */ |
| 2873 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2874 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2875 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2876 | |
| 2877 | /* |
| 2878 | * Set pin mode and muting |
| 2879 | */ |
| 2880 | /* set front pin widgets 0x14 for output */ |
| 2881 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2882 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2883 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2884 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2885 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2886 | /* Mic2 (as headphone out) for HP output */ |
| 2887 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2888 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2889 | /* Line In pin widget for input */ |
| 2890 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2891 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2892 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2893 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2894 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2895 | /* CD pin widget for input */ |
| 2896 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2897 | |
| 2898 | { } |
| 2899 | }; |
| 2900 | |
| 2901 | /* |
| 2902 | * 5-stack pin configuration: |
| 2903 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2904 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2905 | */ |
| 2906 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2907 | /* |
| 2908 | * preset connection lists of input pins |
| 2909 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2910 | */ |
| 2911 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2912 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2913 | |
| 2914 | /* |
| 2915 | * Set pin mode and muting |
| 2916 | */ |
| 2917 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2918 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2919 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2920 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2921 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2922 | /* unmute pins for output (no gain on this amp) */ |
| 2923 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2924 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2925 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2926 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2927 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2928 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2929 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2930 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2931 | /* Mic2 (as headphone out) for HP output */ |
| 2932 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2933 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2934 | /* Line In pin widget for input */ |
| 2935 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2936 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2937 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2938 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2939 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2940 | /* CD pin widget for input */ |
| 2941 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2942 | |
| 2943 | { } |
| 2944 | }; |
| 2945 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2946 | /* |
| 2947 | * W810 pin configuration: |
| 2948 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2949 | */ |
| 2950 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2951 | /* hphone/speaker input selector: front DAC */ |
| 2952 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2953 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2954 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2955 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2956 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2957 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2958 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2959 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2960 | |
| 2961 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2962 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2963 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2964 | { } |
| 2965 | }; |
| 2966 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2967 | /* |
| 2968 | * Z71V pin configuration: |
| 2969 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2970 | */ |
| 2971 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2972 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2973 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2974 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2975 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2976 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2977 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2978 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2979 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2980 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2981 | |
| 2982 | { } |
| 2983 | }; |
| 2984 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2985 | /* |
| 2986 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2987 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2988 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2989 | */ |
| 2990 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2991 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2992 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2993 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2994 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2995 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2996 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2997 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2998 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2999 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3000 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3001 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3002 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3003 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3004 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3005 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3006 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3007 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3008 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3009 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3010 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3011 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3012 | { } |
| 3013 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3014 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3015 | /* |
| 3016 | * Uniwill pin configuration: |
| 3017 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 3018 | * line = 0x1a |
| 3019 | */ |
| 3020 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 3021 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3022 | |
| 3023 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3024 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3025 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3026 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3027 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3028 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3029 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3030 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3031 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3032 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3033 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3034 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3035 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3036 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3037 | |
| 3038 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3039 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3040 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3041 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3042 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3043 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3044 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 3045 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 3046 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3047 | |
| 3048 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3049 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 3050 | |
| 3051 | { } |
| 3052 | }; |
| 3053 | |
| 3054 | /* |
| 3055 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3056 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3057 | */ |
| 3058 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 3059 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3060 | |
| 3061 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3062 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3063 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3064 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3065 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3066 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3067 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3068 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3069 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3070 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3071 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3072 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3073 | |
| 3074 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3075 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3076 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3077 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3078 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3079 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3080 | |
| 3081 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3082 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3083 | |
| 3084 | { } |
| 3085 | }; |
| 3086 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3087 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 3088 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3089 | { } |
| 3090 | }; |
| 3091 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3092 | /* auto-toggle front mic */ |
| 3093 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 3094 | { |
| 3095 | unsigned int present; |
| 3096 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3097 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3098 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3099 | bits = present ? HDA_AMP_MUTE : 0; |
| 3100 | 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] | 3101 | } |
| 3102 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3103 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3104 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3105 | struct alc_spec *spec = codec->spec; |
| 3106 | |
| 3107 | spec->autocfg.hp_pins[0] = 0x14; |
| 3108 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3109 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3110 | } |
| 3111 | |
| 3112 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3113 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3114 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3115 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3116 | } |
| 3117 | |
| 3118 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3119 | unsigned int res) |
| 3120 | { |
| 3121 | /* Looks like the unsol event is incompatible with the standard |
| 3122 | * definition. 4bit tag is placed at 28 bit! |
| 3123 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3124 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3125 | case ALC880_MIC_EVENT: |
| 3126 | alc880_uniwill_mic_automute(codec); |
| 3127 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3128 | default: |
| 3129 | alc_automute_amp_unsol_event(codec, res); |
| 3130 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3131 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3132 | } |
| 3133 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3134 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3135 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3136 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3137 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3138 | spec->autocfg.hp_pins[0] = 0x14; |
| 3139 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3140 | } |
| 3141 | |
| 3142 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3143 | { |
| 3144 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3145 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3146 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3147 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3148 | present &= HDA_AMP_VOLMASK; |
| 3149 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3150 | HDA_AMP_VOLMASK, present); |
| 3151 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3152 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3153 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3154 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3155 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3156 | unsigned int res) |
| 3157 | { |
| 3158 | /* Looks like the unsol event is incompatible with the standard |
| 3159 | * definition. 4bit tag is placed at 28 bit! |
| 3160 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3161 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3162 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3163 | else |
| 3164 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3165 | } |
| 3166 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3167 | /* |
| 3168 | * F1734 pin configuration: |
| 3169 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3170 | */ |
| 3171 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3172 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3173 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3174 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3175 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3176 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3177 | |
| 3178 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3179 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3180 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3181 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3182 | |
| 3183 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3184 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3185 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3186 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3187 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3188 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3189 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3190 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3191 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3192 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3193 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3194 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3195 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3196 | { } |
| 3197 | }; |
| 3198 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3199 | /* |
| 3200 | * ASUS pin configuration: |
| 3201 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3202 | */ |
| 3203 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3204 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3205 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3206 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3207 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3208 | |
| 3209 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3210 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3211 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3212 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3213 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3214 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3215 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3216 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3217 | |
| 3218 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3219 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3220 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3221 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3222 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3223 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3224 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3225 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3226 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3227 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3228 | { } |
| 3229 | }; |
| 3230 | |
| 3231 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3232 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3233 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3234 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3235 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3236 | /* Clevo m520g init */ |
| 3237 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3238 | /* headphone output */ |
| 3239 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3240 | /* line-out */ |
| 3241 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3242 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3243 | /* Line-in */ |
| 3244 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3245 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3246 | /* CD */ |
| 3247 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3248 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3249 | /* Mic1 (rear panel) */ |
| 3250 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3251 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3252 | /* Mic2 (front panel) */ |
| 3253 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3254 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3255 | /* headphone */ |
| 3256 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3257 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3258 | /* change to EAPD mode */ |
| 3259 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3260 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3261 | |
| 3262 | { } |
| 3263 | }; |
| 3264 | |
| 3265 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3266 | /* change to EAPD mode */ |
| 3267 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3268 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3269 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3270 | /* Headphone output */ |
| 3271 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3272 | /* Front output*/ |
| 3273 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3274 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3275 | |
| 3276 | /* Line In pin widget for input */ |
| 3277 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3278 | /* CD pin widget for input */ |
| 3279 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3280 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3281 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3282 | |
| 3283 | /* change to EAPD mode */ |
| 3284 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3285 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3286 | |
| 3287 | { } |
| 3288 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3289 | |
| 3290 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3291 | * LG m1 express dual |
| 3292 | * |
| 3293 | * Pin assignment: |
| 3294 | * Rear Line-In/Out (blue): 0x14 |
| 3295 | * Build-in Mic-In: 0x15 |
| 3296 | * Speaker-out: 0x17 |
| 3297 | * HP-Out (green): 0x1b |
| 3298 | * Mic-In/Out (red): 0x19 |
| 3299 | * SPDIF-Out: 0x1e |
| 3300 | */ |
| 3301 | |
| 3302 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3303 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3304 | 0x05, 0x02, 0x03 |
| 3305 | }; |
| 3306 | |
| 3307 | /* seems analog CD is not working */ |
| 3308 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3309 | .num_items = 3, |
| 3310 | .items = { |
| 3311 | { "Mic", 0x1 }, |
| 3312 | { "Line", 0x5 }, |
| 3313 | { "Internal Mic", 0x6 }, |
| 3314 | }, |
| 3315 | }; |
| 3316 | |
| 3317 | /* 2,4,6 channel modes */ |
| 3318 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3319 | /* set line-in and mic-in to input */ |
| 3320 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3321 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3322 | { } |
| 3323 | }; |
| 3324 | |
| 3325 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3326 | /* set line-in to out and mic-in to input */ |
| 3327 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3328 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3329 | { } |
| 3330 | }; |
| 3331 | |
| 3332 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3333 | /* set line-in and mic-in to output */ |
| 3334 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3335 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3336 | { } |
| 3337 | }; |
| 3338 | |
| 3339 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3340 | { 2, alc880_lg_ch2_init }, |
| 3341 | { 4, alc880_lg_ch4_init }, |
| 3342 | { 6, alc880_lg_ch6_init }, |
| 3343 | }; |
| 3344 | |
| 3345 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3346 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3347 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3348 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3349 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3350 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3351 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3352 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3353 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3354 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3355 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3356 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3357 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3358 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3359 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3360 | { |
| 3361 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3362 | .name = "Channel Mode", |
| 3363 | .info = alc_ch_mode_info, |
| 3364 | .get = alc_ch_mode_get, |
| 3365 | .put = alc_ch_mode_put, |
| 3366 | }, |
| 3367 | { } /* end */ |
| 3368 | }; |
| 3369 | |
| 3370 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3371 | /* set capture source to mic-in */ |
| 3372 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3373 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3374 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3375 | /* mute all amp mixer inputs */ |
| 3376 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3377 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3378 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3379 | /* line-in to input */ |
| 3380 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3381 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3382 | /* built-in mic */ |
| 3383 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3384 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3385 | /* speaker-out */ |
| 3386 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3387 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3388 | /* mic-in to input */ |
| 3389 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3390 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3391 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3392 | /* HP-out */ |
| 3393 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3394 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3395 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3396 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3397 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3398 | { } |
| 3399 | }; |
| 3400 | |
| 3401 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3402 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3403 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3404 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3405 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3406 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3407 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3408 | } |
| 3409 | |
| 3410 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3411 | * LG LW20 |
| 3412 | * |
| 3413 | * Pin assignment: |
| 3414 | * Speaker-out: 0x14 |
| 3415 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3416 | * Built-in Mic-In: 0x19 |
| 3417 | * Line-In: 0x1b |
| 3418 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3419 | * SPDIF-Out: 0x1e |
| 3420 | */ |
| 3421 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3422 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3423 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3424 | .items = { |
| 3425 | { "Mic", 0x0 }, |
| 3426 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3427 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3428 | }, |
| 3429 | }; |
| 3430 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3431 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3432 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3433 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3434 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3435 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3436 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3437 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3438 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3439 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3440 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3441 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3442 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3443 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3444 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3445 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3446 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3447 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3448 | { |
| 3449 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3450 | .name = "Channel Mode", |
| 3451 | .info = alc_ch_mode_info, |
| 3452 | .get = alc_ch_mode_get, |
| 3453 | .put = alc_ch_mode_put, |
| 3454 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3455 | { } /* end */ |
| 3456 | }; |
| 3457 | |
| 3458 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3459 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3460 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3461 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3462 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3463 | /* set capture source to mic-in */ |
| 3464 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3465 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3466 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3467 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3468 | /* speaker-out */ |
| 3469 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3470 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3471 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3472 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3473 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3474 | /* mic-in to input */ |
| 3475 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3476 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3477 | /* built-in mic */ |
| 3478 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3479 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3480 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3481 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3482 | { } |
| 3483 | }; |
| 3484 | |
| 3485 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3486 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3487 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3488 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3489 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3490 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3491 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3492 | } |
| 3493 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3494 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3495 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3496 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3497 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3498 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3499 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3500 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3501 | { } /* end */ |
| 3502 | }; |
| 3503 | |
| 3504 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3505 | .num_items = 2, |
| 3506 | .items = { |
| 3507 | { "Mic", 0x0 }, |
| 3508 | { "Internal Mic", 0x1 }, |
| 3509 | }, |
| 3510 | }; |
| 3511 | |
| 3512 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3513 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3514 | |
| 3515 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3516 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3517 | |
| 3518 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3519 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3520 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3521 | /* Mic2 (as headphone out) for HP output */ |
| 3522 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3523 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3524 | /* Internal Speaker */ |
| 3525 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3526 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3527 | |
| 3528 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3529 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3530 | |
| 3531 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3532 | { } |
| 3533 | }; |
| 3534 | |
| 3535 | /* toggle speaker-output according to the hp-jack state */ |
| 3536 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3537 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3538 | struct alc_spec *spec = codec->spec; |
| 3539 | alc_automute_amp(codec); |
| 3540 | /* toggle EAPD */ |
| 3541 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3542 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3543 | else |
| 3544 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3545 | } |
| 3546 | |
| 3547 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3548 | unsigned int res) |
| 3549 | { |
| 3550 | /* Looks like the unsol event is incompatible with the standard |
| 3551 | * definition. 4bit tag is placed at 28 bit! |
| 3552 | */ |
| 3553 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3554 | alc880_medion_rim_automute(codec); |
| 3555 | } |
| 3556 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3557 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3558 | { |
| 3559 | struct alc_spec *spec = codec->spec; |
| 3560 | |
| 3561 | spec->autocfg.hp_pins[0] = 0x14; |
| 3562 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3563 | } |
| 3564 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3565 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3566 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3567 | { 0x0b, HDA_INPUT, 0 }, |
| 3568 | { 0x0b, HDA_INPUT, 1 }, |
| 3569 | { 0x0b, HDA_INPUT, 2 }, |
| 3570 | { 0x0b, HDA_INPUT, 3 }, |
| 3571 | { 0x0b, HDA_INPUT, 4 }, |
| 3572 | { } /* end */ |
| 3573 | }; |
| 3574 | |
| 3575 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3576 | { 0x0b, HDA_INPUT, 1 }, |
| 3577 | { 0x0b, HDA_INPUT, 6 }, |
| 3578 | { 0x0b, HDA_INPUT, 7 }, |
| 3579 | { } /* end */ |
| 3580 | }; |
| 3581 | #endif |
| 3582 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3583 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3584 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3585 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3586 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3587 | static int alc_init(struct hda_codec *codec) |
| 3588 | { |
| 3589 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3590 | unsigned int i; |
| 3591 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3592 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3593 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3594 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3595 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3596 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3597 | |
| 3598 | if (spec->init_hook) |
| 3599 | spec->init_hook(codec); |
| 3600 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 3601 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3602 | if (codec->patch_ops.check_power_status) |
| 3603 | codec->patch_ops.check_power_status(codec, 0x01); |
| 3604 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3605 | return 0; |
| 3606 | } |
| 3607 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3608 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3609 | { |
| 3610 | struct alc_spec *spec = codec->spec; |
| 3611 | |
| 3612 | if (spec->unsol_event) |
| 3613 | spec->unsol_event(codec, res); |
| 3614 | } |
| 3615 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3616 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3617 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3618 | { |
| 3619 | struct alc_spec *spec = codec->spec; |
| 3620 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3621 | } |
| 3622 | #endif |
| 3623 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3624 | /* |
| 3625 | * Analog playback callbacks |
| 3626 | */ |
| 3627 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3628 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3629 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3630 | { |
| 3631 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3632 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3633 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3634 | } |
| 3635 | |
| 3636 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3637 | struct hda_codec *codec, |
| 3638 | unsigned int stream_tag, |
| 3639 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3640 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3641 | { |
| 3642 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3643 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3644 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3645 | } |
| 3646 | |
| 3647 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3648 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3649 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3650 | { |
| 3651 | struct alc_spec *spec = codec->spec; |
| 3652 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3653 | } |
| 3654 | |
| 3655 | /* |
| 3656 | * Digital out |
| 3657 | */ |
| 3658 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3659 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3660 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3661 | { |
| 3662 | struct alc_spec *spec = codec->spec; |
| 3663 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3664 | } |
| 3665 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3666 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3667 | struct hda_codec *codec, |
| 3668 | unsigned int stream_tag, |
| 3669 | unsigned int format, |
| 3670 | struct snd_pcm_substream *substream) |
| 3671 | { |
| 3672 | struct alc_spec *spec = codec->spec; |
| 3673 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3674 | stream_tag, format, substream); |
| 3675 | } |
| 3676 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3677 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3678 | struct hda_codec *codec, |
| 3679 | struct snd_pcm_substream *substream) |
| 3680 | { |
| 3681 | struct alc_spec *spec = codec->spec; |
| 3682 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3683 | } |
| 3684 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3685 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3686 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3687 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3688 | { |
| 3689 | struct alc_spec *spec = codec->spec; |
| 3690 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3691 | } |
| 3692 | |
| 3693 | /* |
| 3694 | * Analog capture |
| 3695 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3696 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3697 | struct hda_codec *codec, |
| 3698 | unsigned int stream_tag, |
| 3699 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3700 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3701 | { |
| 3702 | struct alc_spec *spec = codec->spec; |
| 3703 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3704 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3705 | stream_tag, 0, format); |
| 3706 | return 0; |
| 3707 | } |
| 3708 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3709 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3710 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3711 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3712 | { |
| 3713 | struct alc_spec *spec = codec->spec; |
| 3714 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3715 | snd_hda_codec_cleanup_stream(codec, |
| 3716 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3717 | return 0; |
| 3718 | } |
| 3719 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 3720 | /* analog capture with dynamic dual-adc changes */ |
| 3721 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3722 | struct hda_codec *codec, |
| 3723 | unsigned int stream_tag, |
| 3724 | unsigned int format, |
| 3725 | struct snd_pcm_substream *substream) |
| 3726 | { |
| 3727 | struct alc_spec *spec = codec->spec; |
| 3728 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 3729 | spec->cur_adc_stream_tag = stream_tag; |
| 3730 | spec->cur_adc_format = format; |
| 3731 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 3732 | return 0; |
| 3733 | } |
| 3734 | |
| 3735 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3736 | struct hda_codec *codec, |
| 3737 | struct snd_pcm_substream *substream) |
| 3738 | { |
| 3739 | struct alc_spec *spec = codec->spec; |
| 3740 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 3741 | spec->cur_adc = 0; |
| 3742 | return 0; |
| 3743 | } |
| 3744 | |
| 3745 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { |
| 3746 | .substreams = 1, |
| 3747 | .channels_min = 2, |
| 3748 | .channels_max = 2, |
| 3749 | .nid = 0, /* fill later */ |
| 3750 | .ops = { |
| 3751 | .prepare = dualmic_capture_pcm_prepare, |
| 3752 | .cleanup = dualmic_capture_pcm_cleanup |
| 3753 | }, |
| 3754 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3755 | |
| 3756 | /* |
| 3757 | */ |
| 3758 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3759 | .substreams = 1, |
| 3760 | .channels_min = 2, |
| 3761 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3762 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3763 | .ops = { |
| 3764 | .open = alc880_playback_pcm_open, |
| 3765 | .prepare = alc880_playback_pcm_prepare, |
| 3766 | .cleanup = alc880_playback_pcm_cleanup |
| 3767 | }, |
| 3768 | }; |
| 3769 | |
| 3770 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3771 | .substreams = 1, |
| 3772 | .channels_min = 2, |
| 3773 | .channels_max = 2, |
| 3774 | /* NID is set in alc_build_pcms */ |
| 3775 | }; |
| 3776 | |
| 3777 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3778 | .substreams = 1, |
| 3779 | .channels_min = 2, |
| 3780 | .channels_max = 2, |
| 3781 | /* NID is set in alc_build_pcms */ |
| 3782 | }; |
| 3783 | |
| 3784 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3785 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3786 | .channels_min = 2, |
| 3787 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3788 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3789 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3790 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3791 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3792 | }, |
| 3793 | }; |
| 3794 | |
| 3795 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3796 | .substreams = 1, |
| 3797 | .channels_min = 2, |
| 3798 | .channels_max = 2, |
| 3799 | /* NID is set in alc_build_pcms */ |
| 3800 | .ops = { |
| 3801 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3802 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3803 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3804 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3805 | }, |
| 3806 | }; |
| 3807 | |
| 3808 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3809 | .substreams = 1, |
| 3810 | .channels_min = 2, |
| 3811 | .channels_max = 2, |
| 3812 | /* NID is set in alc_build_pcms */ |
| 3813 | }; |
| 3814 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3815 | /* 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] | 3816 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3817 | .substreams = 0, |
| 3818 | .channels_min = 0, |
| 3819 | .channels_max = 0, |
| 3820 | }; |
| 3821 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3822 | static int alc_build_pcms(struct hda_codec *codec) |
| 3823 | { |
| 3824 | struct alc_spec *spec = codec->spec; |
| 3825 | struct hda_pcm *info = spec->pcm_rec; |
| 3826 | int i; |
| 3827 | |
| 3828 | codec->num_pcms = 1; |
| 3829 | codec->pcm_info = info; |
| 3830 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3831 | if (spec->no_analog) |
| 3832 | goto skip_analog; |
| 3833 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3834 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3835 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3836 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 3837 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3838 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3839 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3840 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3841 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3842 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3843 | } |
| 3844 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3845 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3846 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3847 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3848 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3849 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3850 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3851 | if (spec->channel_mode) { |
| 3852 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3853 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3854 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3855 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3856 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3857 | } |
| 3858 | } |
| 3859 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3860 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3861 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3862 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3863 | snprintf(spec->stream_name_digital, |
| 3864 | sizeof(spec->stream_name_digital), |
| 3865 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3866 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3867 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3868 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3869 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3870 | if (spec->dig_out_type) |
| 3871 | info->pcm_type = spec->dig_out_type; |
| 3872 | else |
| 3873 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3874 | if (spec->multiout.dig_out_nid && |
| 3875 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3876 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3877 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3878 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3879 | if (spec->dig_in_nid && |
| 3880 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3881 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3882 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3883 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3884 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3885 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3886 | } |
| 3887 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3888 | if (spec->no_analog) |
| 3889 | return 0; |
| 3890 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3891 | /* If the use of more than one ADC is requested for the current |
| 3892 | * model, configure a second analog capture-only PCM. |
| 3893 | */ |
| 3894 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3895 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3896 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3897 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3898 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3899 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3900 | if (spec->alt_dac_nid) { |
| 3901 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3902 | *spec->stream_analog_alt_playback; |
| 3903 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3904 | spec->alt_dac_nid; |
| 3905 | } else { |
| 3906 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3907 | alc_pcm_null_stream; |
| 3908 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3909 | } |
| 3910 | if (spec->num_adc_nids > 1) { |
| 3911 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3912 | *spec->stream_analog_alt_capture; |
| 3913 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3914 | spec->adc_nids[1]; |
| 3915 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3916 | spec->num_adc_nids - 1; |
| 3917 | } else { |
| 3918 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3919 | alc_pcm_null_stream; |
| 3920 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3921 | } |
| 3922 | } |
| 3923 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3924 | return 0; |
| 3925 | } |
| 3926 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3927 | static inline void alc_shutup(struct hda_codec *codec) |
| 3928 | { |
| 3929 | snd_hda_shutup_pins(codec); |
| 3930 | } |
| 3931 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3932 | static void alc_free_kctls(struct hda_codec *codec) |
| 3933 | { |
| 3934 | struct alc_spec *spec = codec->spec; |
| 3935 | |
| 3936 | if (spec->kctls.list) { |
| 3937 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3938 | int i; |
| 3939 | for (i = 0; i < spec->kctls.used; i++) |
| 3940 | kfree(kctl[i].name); |
| 3941 | } |
| 3942 | snd_array_free(&spec->kctls); |
| 3943 | } |
| 3944 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3945 | static void alc_free(struct hda_codec *codec) |
| 3946 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3947 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3948 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3949 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3950 | return; |
| 3951 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3952 | alc_shutup(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3953 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3954 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3955 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3956 | } |
| 3957 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3958 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3959 | static void alc_power_eapd(struct hda_codec *codec) |
| 3960 | { |
| 3961 | /* We currently only handle front, HP */ |
| 3962 | switch (codec->vendor_id) { |
| 3963 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3964 | set_eapd(codec, 0x0f, 0); |
| 3965 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3966 | break; |
| 3967 | case 0x10ec0262: |
| 3968 | case 0x10ec0267: |
| 3969 | case 0x10ec0268: |
| 3970 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3971 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3972 | case 0x10ec0272: |
| 3973 | case 0x10ec0660: |
| 3974 | case 0x10ec0662: |
| 3975 | case 0x10ec0663: |
| 3976 | case 0x10ec0862: |
| 3977 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3978 | set_eapd(codec, 0x14, 0); |
| 3979 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3980 | break; |
| 3981 | } |
| 3982 | } |
| 3983 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3984 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 3985 | { |
| 3986 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3987 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3988 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3989 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3990 | return 0; |
| 3991 | } |
| 3992 | #endif |
| 3993 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3994 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3995 | static int alc_resume(struct hda_codec *codec) |
| 3996 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3997 | codec->patch_ops.init(codec); |
| 3998 | snd_hda_codec_resume_amp(codec); |
| 3999 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 4000 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4001 | if (codec->patch_ops.check_power_status) |
| 4002 | codec->patch_ops.check_power_status(codec, 0x01); |
| 4003 | #endif |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4004 | return 0; |
| 4005 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4006 | #endif |
| 4007 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4008 | /* |
| 4009 | */ |
| 4010 | static struct hda_codec_ops alc_patch_ops = { |
| 4011 | .build_controls = alc_build_controls, |
| 4012 | .build_pcms = alc_build_pcms, |
| 4013 | .init = alc_init, |
| 4014 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4015 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4016 | #ifdef SND_HDA_NEEDS_RESUME |
| 4017 | .resume = alc_resume, |
| 4018 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4019 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4020 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4021 | .check_power_status = alc_check_power_status, |
| 4022 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4023 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4024 | }; |
| 4025 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 4026 | /* replace the codec chip_name with the given string */ |
| 4027 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 4028 | { |
| 4029 | kfree(codec->chip_name); |
| 4030 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 4031 | if (!codec->chip_name) { |
| 4032 | alc_free(codec); |
| 4033 | return -ENOMEM; |
| 4034 | } |
| 4035 | return 0; |
| 4036 | } |
| 4037 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4038 | /* |
| 4039 | * Test configuration for debugging |
| 4040 | * |
| 4041 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 4042 | * enum controls. |
| 4043 | */ |
| 4044 | #ifdef CONFIG_SND_DEBUG |
| 4045 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 4046 | 0x02, 0x03, 0x04, 0x05 |
| 4047 | }; |
| 4048 | |
| 4049 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4050 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4051 | .items = { |
| 4052 | { "In-1", 0x0 }, |
| 4053 | { "In-2", 0x1 }, |
| 4054 | { "In-3", 0x2 }, |
| 4055 | { "In-4", 0x3 }, |
| 4056 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4057 | { "Front", 0x5 }, |
| 4058 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4059 | }, |
| 4060 | }; |
| 4061 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4062 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4063 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4064 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4065 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4066 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4067 | }; |
| 4068 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4069 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4070 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4071 | { |
| 4072 | static char *texts[] = { |
| 4073 | "N/A", "Line Out", "HP Out", |
| 4074 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4075 | }; |
| 4076 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4077 | uinfo->count = 1; |
| 4078 | uinfo->value.enumerated.items = 8; |
| 4079 | if (uinfo->value.enumerated.item >= 8) |
| 4080 | uinfo->value.enumerated.item = 7; |
| 4081 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4082 | return 0; |
| 4083 | } |
| 4084 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4085 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4086 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4087 | { |
| 4088 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4089 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4090 | unsigned int pin_ctl, item = 0; |
| 4091 | |
| 4092 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4093 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4094 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4095 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4096 | item = 2; |
| 4097 | else |
| 4098 | item = 1; |
| 4099 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4100 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4101 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4102 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4103 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4104 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4105 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4106 | } |
| 4107 | } |
| 4108 | ucontrol->value.enumerated.item[0] = item; |
| 4109 | return 0; |
| 4110 | } |
| 4111 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4112 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4113 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4114 | { |
| 4115 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4116 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4117 | static unsigned int ctls[] = { |
| 4118 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4119 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4120 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4121 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4122 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4123 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4124 | }; |
| 4125 | unsigned int old_ctl, new_ctl; |
| 4126 | |
| 4127 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4128 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4129 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4130 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4131 | int val; |
| 4132 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4133 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4134 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4135 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4136 | HDA_AMP_MUTE : 0; |
| 4137 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4138 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4139 | return 1; |
| 4140 | } |
| 4141 | return 0; |
| 4142 | } |
| 4143 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4144 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4145 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4146 | { |
| 4147 | static char *texts[] = { |
| 4148 | "Front", "Surround", "CLFE", "Side" |
| 4149 | }; |
| 4150 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4151 | uinfo->count = 1; |
| 4152 | uinfo->value.enumerated.items = 4; |
| 4153 | if (uinfo->value.enumerated.item >= 4) |
| 4154 | uinfo->value.enumerated.item = 3; |
| 4155 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4156 | return 0; |
| 4157 | } |
| 4158 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4159 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4160 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4161 | { |
| 4162 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4163 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4164 | unsigned int sel; |
| 4165 | |
| 4166 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4167 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4168 | return 0; |
| 4169 | } |
| 4170 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4171 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4172 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4173 | { |
| 4174 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4175 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4176 | unsigned int sel; |
| 4177 | |
| 4178 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4179 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4180 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4181 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4182 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4183 | return 1; |
| 4184 | } |
| 4185 | return 0; |
| 4186 | } |
| 4187 | |
| 4188 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4189 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4190 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4191 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4192 | .info = alc_test_pin_ctl_info, \ |
| 4193 | .get = alc_test_pin_ctl_get, \ |
| 4194 | .put = alc_test_pin_ctl_put, \ |
| 4195 | .private_value = nid \ |
| 4196 | } |
| 4197 | |
| 4198 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4199 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4200 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4201 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4202 | .info = alc_test_pin_src_info, \ |
| 4203 | .get = alc_test_pin_src_get, \ |
| 4204 | .put = alc_test_pin_src_put, \ |
| 4205 | .private_value = nid \ |
| 4206 | } |
| 4207 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4208 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4209 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4210 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4211 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4212 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4213 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4214 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4215 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4216 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4217 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4218 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4219 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4220 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4221 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4222 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4223 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4224 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4225 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4226 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4227 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4228 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4229 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4230 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4231 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4232 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4233 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4234 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4235 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4236 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4237 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4238 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4239 | { |
| 4240 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4241 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4242 | .info = alc_ch_mode_info, |
| 4243 | .get = alc_ch_mode_get, |
| 4244 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4245 | }, |
| 4246 | { } /* end */ |
| 4247 | }; |
| 4248 | |
| 4249 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4250 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4251 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4252 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4253 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4254 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4255 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4256 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4257 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4258 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4259 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4260 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4261 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4262 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4263 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4264 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4265 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4266 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4267 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4268 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4269 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4270 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4271 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4272 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4273 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4274 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4275 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4276 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4277 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4278 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4279 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4280 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4281 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4282 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4283 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4284 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4285 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4286 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4287 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4288 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4289 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4290 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4291 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4292 | /* Analog input/passthru */ |
| 4293 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4294 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4295 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4296 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4297 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4298 | { } |
| 4299 | }; |
| 4300 | #endif |
| 4301 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4302 | /* |
| 4303 | */ |
| 4304 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4305 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 4306 | [ALC880_3ST] = "3stack", |
| 4307 | [ALC880_TCL_S700] = "tcl", |
| 4308 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4309 | [ALC880_CLEVO] = "clevo", |
| 4310 | [ALC880_5ST] = "5stack", |
| 4311 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4312 | [ALC880_W810] = "w810", |
| 4313 | [ALC880_Z71V] = "z71v", |
| 4314 | [ALC880_6ST] = "6stack", |
| 4315 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4316 | [ALC880_ASUS] = "asus", |
| 4317 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4318 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4319 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4320 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4321 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4322 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4323 | [ALC880_F1734] = "F1734", |
| 4324 | [ALC880_LG] = "lg", |
| 4325 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4326 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4327 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4328 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4329 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4330 | [ALC880_AUTO] = "auto", |
| 4331 | }; |
| 4332 | |
| 4333 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4334 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4335 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4336 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4337 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4338 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4339 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4340 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4341 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4342 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4343 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4344 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4345 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4346 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4347 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4348 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4349 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4350 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4351 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4352 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4353 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4354 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4355 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4356 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4357 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4358 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4359 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4360 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4361 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4362 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4363 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4364 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4365 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4366 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4367 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4368 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4369 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4370 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4371 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4372 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4373 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4374 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4375 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4376 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4377 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4378 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4379 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4380 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4381 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4382 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4383 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4384 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4385 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4386 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 4387 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4388 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4389 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4390 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4391 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4392 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4393 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4394 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4395 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4396 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4397 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4398 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4399 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4400 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4401 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4402 | /* default Intel */ |
| 4403 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4404 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4405 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4406 | {} |
| 4407 | }; |
| 4408 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4409 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4410 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4411 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4412 | static struct alc_config_preset alc880_presets[] = { |
| 4413 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4414 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4415 | .init_verbs = { alc880_volume_init_verbs, |
| 4416 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4417 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4418 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4419 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4420 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4421 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4422 | .input_mux = &alc880_capture_source, |
| 4423 | }, |
| 4424 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4425 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4426 | .init_verbs = { alc880_volume_init_verbs, |
| 4427 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4428 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4429 | .dac_nids = alc880_dac_nids, |
| 4430 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4431 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4432 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4433 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4434 | .input_mux = &alc880_capture_source, |
| 4435 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4436 | [ALC880_TCL_S700] = { |
| 4437 | .mixers = { alc880_tcl_s700_mixer }, |
| 4438 | .init_verbs = { alc880_volume_init_verbs, |
| 4439 | alc880_pin_tcl_S700_init_verbs, |
| 4440 | alc880_gpio2_init_verbs }, |
| 4441 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4442 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4443 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4444 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4445 | .hp_nid = 0x03, |
| 4446 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4447 | .channel_mode = alc880_2_jack_modes, |
| 4448 | .input_mux = &alc880_capture_source, |
| 4449 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4450 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4451 | .mixers = { alc880_three_stack_mixer, |
| 4452 | alc880_five_stack_mixer}, |
| 4453 | .init_verbs = { alc880_volume_init_verbs, |
| 4454 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4455 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4456 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4457 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4458 | .channel_mode = alc880_fivestack_modes, |
| 4459 | .input_mux = &alc880_capture_source, |
| 4460 | }, |
| 4461 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4462 | .mixers = { alc880_three_stack_mixer, |
| 4463 | alc880_five_stack_mixer }, |
| 4464 | .init_verbs = { alc880_volume_init_verbs, |
| 4465 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4466 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4467 | .dac_nids = alc880_dac_nids, |
| 4468 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4469 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4470 | .channel_mode = alc880_fivestack_modes, |
| 4471 | .input_mux = &alc880_capture_source, |
| 4472 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4473 | [ALC880_6ST] = { |
| 4474 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4475 | .init_verbs = { alc880_volume_init_verbs, |
| 4476 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4477 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4478 | .dac_nids = alc880_6st_dac_nids, |
| 4479 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4480 | .channel_mode = alc880_sixstack_modes, |
| 4481 | .input_mux = &alc880_6stack_capture_source, |
| 4482 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4483 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4484 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4485 | .init_verbs = { alc880_volume_init_verbs, |
| 4486 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4487 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4488 | .dac_nids = alc880_6st_dac_nids, |
| 4489 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4490 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4491 | .channel_mode = alc880_sixstack_modes, |
| 4492 | .input_mux = &alc880_6stack_capture_source, |
| 4493 | }, |
| 4494 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4495 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4496 | .init_verbs = { alc880_volume_init_verbs, |
| 4497 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4498 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4499 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4500 | .dac_nids = alc880_w810_dac_nids, |
| 4501 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4502 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4503 | .channel_mode = alc880_w810_modes, |
| 4504 | .input_mux = &alc880_capture_source, |
| 4505 | }, |
| 4506 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4507 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4508 | .init_verbs = { alc880_volume_init_verbs, |
| 4509 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4510 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4511 | .dac_nids = alc880_z71v_dac_nids, |
| 4512 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4513 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4514 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4515 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4516 | .input_mux = &alc880_capture_source, |
| 4517 | }, |
| 4518 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4519 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4520 | .init_verbs = { alc880_volume_init_verbs, |
| 4521 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4522 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4523 | .dac_nids = alc880_f1734_dac_nids, |
| 4524 | .hp_nid = 0x02, |
| 4525 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4526 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4527 | .input_mux = &alc880_f1734_capture_source, |
| 4528 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4529 | .setup = alc880_uniwill_p53_setup, |
| 4530 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4531 | }, |
| 4532 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4533 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4534 | .init_verbs = { alc880_volume_init_verbs, |
| 4535 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4536 | alc880_gpio1_init_verbs }, |
| 4537 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4538 | .dac_nids = alc880_asus_dac_nids, |
| 4539 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4540 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4541 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4542 | .input_mux = &alc880_capture_source, |
| 4543 | }, |
| 4544 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4545 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4546 | .init_verbs = { alc880_volume_init_verbs, |
| 4547 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4548 | alc880_gpio1_init_verbs }, |
| 4549 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4550 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4551 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4552 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4553 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4554 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4555 | .input_mux = &alc880_capture_source, |
| 4556 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4557 | [ALC880_ASUS_DIG2] = { |
| 4558 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4559 | .init_verbs = { alc880_volume_init_verbs, |
| 4560 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4561 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4562 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4563 | .dac_nids = alc880_asus_dac_nids, |
| 4564 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4565 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4566 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4567 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4568 | .input_mux = &alc880_capture_source, |
| 4569 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4570 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4571 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4572 | .init_verbs = { alc880_volume_init_verbs, |
| 4573 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4574 | alc880_gpio1_init_verbs }, |
| 4575 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4576 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4577 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4578 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4579 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4580 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4581 | .input_mux = &alc880_capture_source, |
| 4582 | }, |
| 4583 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4584 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4585 | .init_verbs = { alc880_volume_init_verbs, |
| 4586 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4587 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4588 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4589 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4590 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4591 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4592 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4593 | .input_mux = &alc880_capture_source, |
| 4594 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4595 | [ALC880_UNIWILL] = { |
| 4596 | .mixers = { alc880_uniwill_mixer }, |
| 4597 | .init_verbs = { alc880_volume_init_verbs, |
| 4598 | alc880_uniwill_init_verbs }, |
| 4599 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4600 | .dac_nids = alc880_asus_dac_nids, |
| 4601 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4602 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4603 | .channel_mode = alc880_threestack_modes, |
| 4604 | .need_dac_fix = 1, |
| 4605 | .input_mux = &alc880_capture_source, |
| 4606 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4607 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4608 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4609 | }, |
| 4610 | [ALC880_UNIWILL_P53] = { |
| 4611 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4612 | .init_verbs = { alc880_volume_init_verbs, |
| 4613 | alc880_uniwill_p53_init_verbs }, |
| 4614 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4615 | .dac_nids = alc880_asus_dac_nids, |
| 4616 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4617 | .channel_mode = alc880_threestack_modes, |
| 4618 | .input_mux = &alc880_capture_source, |
| 4619 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4620 | .setup = alc880_uniwill_p53_setup, |
| 4621 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4622 | }, |
| 4623 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4624 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4625 | .init_verbs = { alc880_volume_init_verbs, |
| 4626 | alc880_uniwill_p53_init_verbs, |
| 4627 | alc880_beep_init_verbs }, |
| 4628 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4629 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4630 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4631 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4632 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4633 | .input_mux = &alc880_capture_source, |
| 4634 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4635 | .setup = alc880_uniwill_p53_setup, |
| 4636 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4637 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4638 | [ALC880_CLEVO] = { |
| 4639 | .mixers = { alc880_three_stack_mixer }, |
| 4640 | .init_verbs = { alc880_volume_init_verbs, |
| 4641 | alc880_pin_clevo_init_verbs }, |
| 4642 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4643 | .dac_nids = alc880_dac_nids, |
| 4644 | .hp_nid = 0x03, |
| 4645 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4646 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4647 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4648 | .input_mux = &alc880_capture_source, |
| 4649 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4650 | [ALC880_LG] = { |
| 4651 | .mixers = { alc880_lg_mixer }, |
| 4652 | .init_verbs = { alc880_volume_init_verbs, |
| 4653 | alc880_lg_init_verbs }, |
| 4654 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4655 | .dac_nids = alc880_lg_dac_nids, |
| 4656 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4657 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4658 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4659 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4660 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4661 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4662 | .setup = alc880_lg_setup, |
| 4663 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4664 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4665 | .loopbacks = alc880_lg_loopbacks, |
| 4666 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4667 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4668 | [ALC880_LG_LW] = { |
| 4669 | .mixers = { alc880_lg_lw_mixer }, |
| 4670 | .init_verbs = { alc880_volume_init_verbs, |
| 4671 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4672 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4673 | .dac_nids = alc880_dac_nids, |
| 4674 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4675 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4676 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4677 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4678 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4679 | .setup = alc880_lg_lw_setup, |
| 4680 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4681 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4682 | [ALC880_MEDION_RIM] = { |
| 4683 | .mixers = { alc880_medion_rim_mixer }, |
| 4684 | .init_verbs = { alc880_volume_init_verbs, |
| 4685 | alc880_medion_rim_init_verbs, |
| 4686 | alc_gpio2_init_verbs }, |
| 4687 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4688 | .dac_nids = alc880_dac_nids, |
| 4689 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4690 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4691 | .channel_mode = alc880_2_jack_modes, |
| 4692 | .input_mux = &alc880_medion_rim_capture_source, |
| 4693 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4694 | .setup = alc880_medion_rim_setup, |
| 4695 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4696 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4697 | #ifdef CONFIG_SND_DEBUG |
| 4698 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4699 | .mixers = { alc880_test_mixer }, |
| 4700 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4701 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4702 | .dac_nids = alc880_test_dac_nids, |
| 4703 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4704 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4705 | .channel_mode = alc880_test_modes, |
| 4706 | .input_mux = &alc880_test_capture_source, |
| 4707 | }, |
| 4708 | #endif |
| 4709 | }; |
| 4710 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4711 | /* |
| 4712 | * Automatic parse of I/O pins from the BIOS configuration |
| 4713 | */ |
| 4714 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4715 | enum { |
| 4716 | ALC_CTL_WIDGET_VOL, |
| 4717 | ALC_CTL_WIDGET_MUTE, |
| 4718 | ALC_CTL_BIND_MUTE, |
| 4719 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4720 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4721 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4722 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4723 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4724 | }; |
| 4725 | |
| 4726 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4727 | 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] | 4728 | int cidx, unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4729 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4730 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4731 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4732 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4733 | knew = snd_array_new(&spec->kctls); |
| 4734 | if (!knew) |
| 4735 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4736 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4737 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4738 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4739 | return -ENOMEM; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4740 | knew->index = cidx; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 4741 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 4742 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4743 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4744 | return 0; |
| 4745 | } |
| 4746 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4747 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 4748 | const char *pfx, const char *dir, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4749 | const char *sfx, int cidx, unsigned long val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4750 | { |
| 4751 | char name[32]; |
| 4752 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4753 | return add_control(spec, type, name, cidx, val); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4754 | } |
| 4755 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4756 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 4757 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) |
| 4758 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 4759 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) |
| 4760 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ |
| 4761 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) |
| 4762 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
| 4763 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4764 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4765 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4766 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4767 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4768 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4769 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4770 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4771 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4772 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4773 | #define ALC880_PIN_CD_NID 0x1c |
| 4774 | |
| 4775 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4776 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4777 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4778 | { |
| 4779 | hda_nid_t nid; |
| 4780 | int assigned[4]; |
| 4781 | int i, j; |
| 4782 | |
| 4783 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4784 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4785 | |
| 4786 | /* check the pins hardwired to audio widget */ |
| 4787 | for (i = 0; i < cfg->line_outs; i++) { |
| 4788 | nid = cfg->line_out_pins[i]; |
| 4789 | if (alc880_is_fixed_pin(nid)) { |
| 4790 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4791 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4792 | assigned[idx] = 1; |
| 4793 | } |
| 4794 | } |
| 4795 | /* left pins can be connect to any audio widget */ |
| 4796 | for (i = 0; i < cfg->line_outs; i++) { |
| 4797 | nid = cfg->line_out_pins[i]; |
| 4798 | if (alc880_is_fixed_pin(nid)) |
| 4799 | continue; |
| 4800 | /* search for an empty channel */ |
| 4801 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4802 | if (!assigned[j]) { |
| 4803 | spec->multiout.dac_nids[i] = |
| 4804 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4805 | assigned[j] = 1; |
| 4806 | break; |
| 4807 | } |
| 4808 | } |
| 4809 | } |
| 4810 | spec->multiout.num_dacs = cfg->line_outs; |
| 4811 | return 0; |
| 4812 | } |
| 4813 | |
| 4814 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4815 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4816 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4817 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4818 | static const char *chname[4] = { |
| 4819 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4820 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4821 | hda_nid_t nid; |
| 4822 | int i, err; |
| 4823 | |
| 4824 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4825 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4826 | continue; |
| 4827 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4828 | if (i == 2) { |
| 4829 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4830 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4831 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4832 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4833 | HDA_OUTPUT)); |
| 4834 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4835 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4836 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4837 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4838 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4839 | HDA_OUTPUT)); |
| 4840 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4841 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4842 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4843 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4844 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4845 | HDA_INPUT)); |
| 4846 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4847 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4848 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4849 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4850 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4851 | HDA_INPUT)); |
| 4852 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4853 | return err; |
| 4854 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4855 | const char *pfx; |
| 4856 | if (cfg->line_outs == 1 && |
| 4857 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 4858 | pfx = "Speaker"; |
| 4859 | else |
| 4860 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4861 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4862 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4863 | HDA_OUTPUT)); |
| 4864 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4865 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4866 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4867 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4868 | HDA_INPUT)); |
| 4869 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4870 | return err; |
| 4871 | } |
| 4872 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4873 | return 0; |
| 4874 | } |
| 4875 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4876 | /* add playback controls for speaker and HP outputs */ |
| 4877 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4878 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4879 | { |
| 4880 | hda_nid_t nid; |
| 4881 | int err; |
| 4882 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4883 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4884 | return 0; |
| 4885 | |
| 4886 | if (alc880_is_fixed_pin(pin)) { |
| 4887 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4888 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4889 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4890 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4891 | else |
| 4892 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4893 | /* control HP volume/switch on the output mixer amp */ |
| 4894 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4895 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4896 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4897 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4898 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4899 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4900 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4901 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4902 | return err; |
| 4903 | } else if (alc880_is_multi_pin(pin)) { |
| 4904 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4905 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4906 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4907 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4908 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4909 | return err; |
| 4910 | } |
| 4911 | return 0; |
| 4912 | } |
| 4913 | |
| 4914 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4915 | 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] | 4916 | const char *ctlname, int ctlidx, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4917 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4918 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4919 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4920 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4921 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4922 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4923 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4924 | return err; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4925 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4926 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4927 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4928 | return err; |
| 4929 | return 0; |
| 4930 | } |
| 4931 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4932 | 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] | 4933 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4934 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 4935 | return (pincap & AC_PINCAP_IN) != 0; |
| 4936 | } |
| 4937 | |
| 4938 | /* create playback/capture controls for input pins */ |
| 4939 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 4940 | const struct auto_pin_cfg *cfg, |
| 4941 | hda_nid_t mixer, |
| 4942 | hda_nid_t cap1, hda_nid_t cap2) |
| 4943 | { |
| 4944 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4945 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4946 | int i, err, idx, type, type_idx = 0; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4947 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4948 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4949 | hda_nid_t pin; |
| 4950 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4951 | pin = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4952 | if (!alc_is_input_pin(codec, pin)) |
| 4953 | continue; |
| 4954 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4955 | type = cfg->inputs[i].type; |
| 4956 | if (i > 0 && type == cfg->inputs[i - 1].type) |
| 4957 | type_idx++; |
| 4958 | else |
| 4959 | type_idx = 0; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4960 | if (mixer) { |
| 4961 | idx = get_connection_index(codec, mixer, pin); |
| 4962 | if (idx >= 0) { |
| 4963 | err = new_analog_input(spec, pin, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 4964 | auto_pin_cfg_labels[type], |
| 4965 | type_idx, idx, mixer); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4966 | if (err < 0) |
| 4967 | return err; |
| 4968 | } |
| 4969 | } |
| 4970 | |
| 4971 | if (!cap1) |
| 4972 | continue; |
| 4973 | idx = get_connection_index(codec, cap1, pin); |
| 4974 | if (idx < 0 && cap2) |
| 4975 | idx = get_connection_index(codec, cap2, pin); |
| 4976 | if (idx >= 0) { |
Takashi Iwai | b5786e8 | 2010-09-09 14:21:17 +0200 | [diff] [blame] | 4977 | snd_hda_get_input_pin_label(cfg, i, |
| 4978 | imux->items[imux->num_items].label); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4979 | imux->items[imux->num_items].index = idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4980 | imux->num_items++; |
| 4981 | } |
| 4982 | } |
| 4983 | return 0; |
| 4984 | } |
| 4985 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4986 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 4987 | const struct auto_pin_cfg *cfg) |
| 4988 | { |
| 4989 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 4990 | } |
| 4991 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4992 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4993 | unsigned int pin_type) |
| 4994 | { |
| 4995 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4996 | pin_type); |
| 4997 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4998 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4999 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5000 | } |
| 5001 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5002 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5003 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5004 | int dac_idx) |
| 5005 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5006 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5007 | /* need the manual connection? */ |
| 5008 | if (alc880_is_multi_pin(nid)) { |
| 5009 | struct alc_spec *spec = codec->spec; |
| 5010 | int idx = alc880_multi_pin_idx(nid); |
| 5011 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 5012 | AC_VERB_SET_CONNECT_SEL, |
| 5013 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 5014 | } |
| 5015 | } |
| 5016 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5017 | static int get_pin_type(int line_out_type) |
| 5018 | { |
| 5019 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5020 | return PIN_HP; |
| 5021 | else |
| 5022 | return PIN_OUT; |
| 5023 | } |
| 5024 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5025 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 5026 | { |
| 5027 | struct alc_spec *spec = codec->spec; |
| 5028 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5029 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5030 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 5031 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5032 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5033 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5034 | } |
| 5035 | } |
| 5036 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5037 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5038 | { |
| 5039 | struct alc_spec *spec = codec->spec; |
| 5040 | hda_nid_t pin; |
| 5041 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5042 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5043 | if (pin) /* connect to front */ |
| 5044 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5045 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5046 | if (pin) /* connect to front */ |
| 5047 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5048 | } |
| 5049 | |
| 5050 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 5051 | { |
| 5052 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5053 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5054 | int i; |
| 5055 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5056 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5057 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5058 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 5059 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5060 | if (nid != ALC880_PIN_CD_NID && |
| 5061 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5062 | snd_hda_codec_write(codec, nid, 0, |
| 5063 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5064 | AMP_OUT_MUTE); |
| 5065 | } |
| 5066 | } |
| 5067 | } |
| 5068 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5069 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5070 | { |
| 5071 | struct alc_spec *spec = codec->spec; |
| 5072 | int c; |
| 5073 | |
| 5074 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5075 | unsigned int mux_idx; |
| 5076 | const struct hda_input_mux *imux; |
| 5077 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5078 | imux = &spec->input_mux[mux_idx]; |
| 5079 | if (!imux->num_items && mux_idx > 0) |
| 5080 | imux = &spec->input_mux[0]; |
| 5081 | if (imux) |
| 5082 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5083 | AC_VERB_SET_CONNECT_SEL, |
| 5084 | imux->items[0].index); |
| 5085 | } |
| 5086 | } |
| 5087 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5088 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5089 | /* return 1 if successful, 0 if the proper config is not found, |
| 5090 | * or a negative error code |
| 5091 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5092 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5093 | { |
| 5094 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5095 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5096 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5097 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5098 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5099 | alc880_ignore); |
| 5100 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5101 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5102 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5103 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5104 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5105 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5106 | if (err < 0) |
| 5107 | return err; |
| 5108 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5109 | if (err < 0) |
| 5110 | return err; |
| 5111 | err = alc880_auto_create_extra_out(spec, |
| 5112 | spec->autocfg.speaker_pins[0], |
| 5113 | "Speaker"); |
| 5114 | if (err < 0) |
| 5115 | return err; |
| 5116 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5117 | "Headphone"); |
| 5118 | if (err < 0) |
| 5119 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5120 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5121 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5122 | return err; |
| 5123 | |
| 5124 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5125 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5126 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5127 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5128 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5129 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5130 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5131 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5132 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5133 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5134 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5135 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5136 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5137 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5138 | return 1; |
| 5139 | } |
| 5140 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5141 | /* additional initialization for auto-configuration model */ |
| 5142 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5143 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5144 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5145 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5146 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5147 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5148 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5149 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5150 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5151 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5152 | } |
| 5153 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5154 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5155 | * one of two digital mic pins, e.g. on ALC272 |
| 5156 | */ |
| 5157 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5158 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5159 | struct alc_spec *spec = codec->spec; |
| 5160 | int i; |
| 5161 | |
| 5162 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5163 | hda_nid_t cap = spec->capsrc_nids ? |
| 5164 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5165 | int iidx, eidx; |
| 5166 | |
| 5167 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5168 | if (iidx < 0) |
| 5169 | continue; |
| 5170 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5171 | if (eidx < 0) |
| 5172 | continue; |
| 5173 | spec->int_mic.mux_idx = iidx; |
| 5174 | spec->ext_mic.mux_idx = eidx; |
| 5175 | if (spec->capsrc_nids) |
| 5176 | spec->capsrc_nids += i; |
| 5177 | spec->adc_nids += i; |
| 5178 | spec->num_adc_nids = 1; |
| 5179 | return; |
| 5180 | } |
| 5181 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5182 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5183 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5184 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5185 | } |
| 5186 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5187 | /* select or unmute the given capsrc route */ |
| 5188 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5189 | int idx) |
| 5190 | { |
| 5191 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5192 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5193 | HDA_AMP_MUTE, 0); |
| 5194 | } else { |
| 5195 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5196 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5197 | } |
| 5198 | } |
| 5199 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5200 | /* set the default connection to that pin */ |
| 5201 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5202 | { |
| 5203 | struct alc_spec *spec = codec->spec; |
| 5204 | int i; |
| 5205 | |
| 5206 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5207 | hda_nid_t cap = spec->capsrc_nids ? |
| 5208 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5209 | int idx; |
| 5210 | |
| 5211 | idx = get_connection_index(codec, cap, pin); |
| 5212 | if (idx < 0) |
| 5213 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5214 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5215 | return i; /* return the found index */ |
| 5216 | } |
| 5217 | return -1; /* not found */ |
| 5218 | } |
| 5219 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5220 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5221 | static void fixup_single_adc(struct hda_codec *codec) |
| 5222 | { |
| 5223 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5224 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5225 | int i; |
| 5226 | |
| 5227 | /* search for the input pin; there must be only one */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5228 | if (cfg->num_inputs != 1) |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5229 | return; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5230 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5231 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5232 | /* use only this ADC */ |
| 5233 | if (spec->capsrc_nids) |
| 5234 | spec->capsrc_nids += i; |
| 5235 | spec->adc_nids += i; |
| 5236 | spec->num_adc_nids = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5237 | } |
| 5238 | } |
| 5239 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5240 | /* initialize dual adcs */ |
| 5241 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5242 | { |
| 5243 | struct alc_spec *spec = codec->spec; |
| 5244 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
| 5245 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5246 | } |
| 5247 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5248 | static void set_capture_mixer(struct hda_codec *codec) |
| 5249 | { |
| 5250 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5251 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5252 | { alc_capture_mixer_nosrc1, |
| 5253 | alc_capture_mixer_nosrc2, |
| 5254 | alc_capture_mixer_nosrc3 }, |
| 5255 | { alc_capture_mixer1, |
| 5256 | alc_capture_mixer2, |
| 5257 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5258 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5259 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5260 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5261 | int num_adcs = spec->num_adc_nids; |
| 5262 | if (spec->dual_adc_switch) |
| 5263 | fixup_dual_adc_switch(codec); |
| 5264 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5265 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5266 | else if (spec->input_mux) { |
| 5267 | if (spec->input_mux->num_items > 1) |
| 5268 | mux = 1; |
| 5269 | else if (spec->input_mux->num_items == 1) |
| 5270 | fixup_single_adc(codec); |
| 5271 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5272 | if (spec->dual_adc_switch) |
| 5273 | num_adcs = 1; |
| 5274 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5275 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5276 | } |
| 5277 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5278 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5279 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5280 | int num_nids) |
| 5281 | { |
| 5282 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5283 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5284 | int n; |
| 5285 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5286 | |
| 5287 | for (n = 0; n < num_nids; n++) { |
| 5288 | hda_nid_t adc, cap; |
| 5289 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5290 | int nconns, i, j; |
| 5291 | |
| 5292 | adc = nids[n]; |
| 5293 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5294 | continue; |
| 5295 | cap = adc; |
| 5296 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5297 | ARRAY_SIZE(conn)); |
| 5298 | if (nconns == 1) { |
| 5299 | cap = conn[0]; |
| 5300 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5301 | ARRAY_SIZE(conn)); |
| 5302 | } |
| 5303 | if (nconns <= 0) |
| 5304 | continue; |
| 5305 | if (!fallback_adc) { |
| 5306 | fallback_adc = adc; |
| 5307 | fallback_cap = cap; |
| 5308 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5309 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5310 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5311 | for (j = 0; j < nconns; j++) { |
| 5312 | if (conn[j] == nid) |
| 5313 | break; |
| 5314 | } |
| 5315 | if (j >= nconns) |
| 5316 | break; |
| 5317 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5318 | if (i >= cfg->num_inputs) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5319 | int num_adcs = spec->num_adc_nids; |
| 5320 | spec->private_adc_nids[num_adcs] = adc; |
| 5321 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5322 | spec->num_adc_nids++; |
| 5323 | spec->adc_nids = spec->private_adc_nids; |
| 5324 | if (adc != cap) |
| 5325 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5326 | } |
| 5327 | } |
| 5328 | if (!spec->num_adc_nids) { |
| 5329 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5330 | " using fallback 0x%x\n", |
| 5331 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5332 | spec->private_adc_nids[0] = fallback_adc; |
| 5333 | spec->adc_nids = spec->private_adc_nids; |
| 5334 | if (fallback_adc != fallback_cap) { |
| 5335 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5336 | spec->capsrc_nids = spec->private_adc_nids; |
| 5337 | } |
| 5338 | } |
| 5339 | } |
| 5340 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5341 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5342 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5343 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5344 | |
| 5345 | static struct snd_pci_quirk beep_white_list[] = { |
| 5346 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 080dc7b | 2010-09-08 08:38:41 +0200 | [diff] [blame] | 5347 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5348 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5349 | {} |
| 5350 | }; |
| 5351 | |
| 5352 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5353 | { |
| 5354 | struct alc_spec *spec = codec->spec; |
| 5355 | const struct snd_pci_quirk *q; |
| 5356 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5357 | if (q) |
| 5358 | return q->value; |
| 5359 | return spec->cdefine.enable_pcbeep; |
| 5360 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5361 | #else |
| 5362 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5363 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5364 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5365 | |
| 5366 | /* |
| 5367 | * OK, here we have finally the patch for ALC880 |
| 5368 | */ |
| 5369 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5370 | static int patch_alc880(struct hda_codec *codec) |
| 5371 | { |
| 5372 | struct alc_spec *spec; |
| 5373 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5374 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5375 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5376 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5377 | if (spec == NULL) |
| 5378 | return -ENOMEM; |
| 5379 | |
| 5380 | codec->spec = spec; |
| 5381 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5382 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5383 | alc880_models, |
| 5384 | alc880_cfg_tbl); |
| 5385 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5386 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5387 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5388 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5389 | } |
| 5390 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5391 | if (board_config == ALC880_AUTO) { |
| 5392 | /* automatic parse from the BIOS config */ |
| 5393 | err = alc880_parse_auto_config(codec); |
| 5394 | if (err < 0) { |
| 5395 | alc_free(codec); |
| 5396 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5397 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5398 | printk(KERN_INFO |
| 5399 | "hda_codec: Cannot set up configuration " |
| 5400 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5401 | board_config = ALC880_3ST; |
| 5402 | } |
| 5403 | } |
| 5404 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5405 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5406 | if (err < 0) { |
| 5407 | alc_free(codec); |
| 5408 | return err; |
| 5409 | } |
| 5410 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5411 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5412 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5413 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5414 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5415 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5416 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5417 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5418 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5419 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5420 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5421 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5422 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5423 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5424 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5425 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5426 | if (wcap != AC_WID_AUD_IN) { |
| 5427 | spec->adc_nids = alc880_adc_nids_alt; |
| 5428 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5429 | } else { |
| 5430 | spec->adc_nids = alc880_adc_nids; |
| 5431 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5432 | } |
| 5433 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5434 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5435 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5436 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5437 | spec->vmaster_nid = 0x0c; |
| 5438 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5439 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5440 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5441 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5442 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5443 | if (!spec->loopback.amplist) |
| 5444 | spec->loopback.amplist = alc880_loopbacks; |
| 5445 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5446 | |
| 5447 | return 0; |
| 5448 | } |
| 5449 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5450 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5451 | /* |
| 5452 | * ALC260 support |
| 5453 | */ |
| 5454 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5455 | static hda_nid_t alc260_dac_nids[1] = { |
| 5456 | /* front */ |
| 5457 | 0x02, |
| 5458 | }; |
| 5459 | |
| 5460 | static hda_nid_t alc260_adc_nids[1] = { |
| 5461 | /* ADC0 */ |
| 5462 | 0x04, |
| 5463 | }; |
| 5464 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5465 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5466 | /* ADC1 */ |
| 5467 | 0x05, |
| 5468 | }; |
| 5469 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5470 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5471 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5472 | */ |
| 5473 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5474 | /* ADC0, ADC1 */ |
| 5475 | 0x04, 0x05 |
| 5476 | }; |
| 5477 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5478 | #define ALC260_DIGOUT_NID 0x03 |
| 5479 | #define ALC260_DIGIN_NID 0x06 |
| 5480 | |
| 5481 | static struct hda_input_mux alc260_capture_source = { |
| 5482 | .num_items = 4, |
| 5483 | .items = { |
| 5484 | { "Mic", 0x0 }, |
| 5485 | { "Front Mic", 0x1 }, |
| 5486 | { "Line", 0x2 }, |
| 5487 | { "CD", 0x4 }, |
| 5488 | }, |
| 5489 | }; |
| 5490 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5491 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5492 | * headphone jack and the internal CD lines since these are the only pins at |
| 5493 | * which audio can appear. For flexibility, also allow the option of |
| 5494 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5495 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5496 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5497 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5498 | { |
| 5499 | .num_items = 3, |
| 5500 | .items = { |
| 5501 | { "Mic/Line", 0x0 }, |
| 5502 | { "CD", 0x4 }, |
| 5503 | { "Headphone", 0x2 }, |
| 5504 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5505 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5506 | { |
| 5507 | .num_items = 4, |
| 5508 | .items = { |
| 5509 | { "Mic/Line", 0x0 }, |
| 5510 | { "CD", 0x4 }, |
| 5511 | { "Headphone", 0x2 }, |
| 5512 | { "Mixer", 0x5 }, |
| 5513 | }, |
| 5514 | }, |
| 5515 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5516 | }; |
| 5517 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5518 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5519 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5520 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5521 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5522 | { |
| 5523 | .num_items = 4, |
| 5524 | .items = { |
| 5525 | { "Mic", 0x0 }, |
| 5526 | { "Line", 0x2 }, |
| 5527 | { "CD", 0x4 }, |
| 5528 | { "Headphone", 0x5 }, |
| 5529 | }, |
| 5530 | }, |
| 5531 | { |
| 5532 | .num_items = 5, |
| 5533 | .items = { |
| 5534 | { "Mic", 0x0 }, |
| 5535 | { "Line", 0x2 }, |
| 5536 | { "CD", 0x4 }, |
| 5537 | { "Headphone", 0x6 }, |
| 5538 | { "Mixer", 0x5 }, |
| 5539 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5540 | }, |
| 5541 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5542 | |
| 5543 | /* Maxdata Favorit 100XS */ |
| 5544 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5545 | { |
| 5546 | .num_items = 2, |
| 5547 | .items = { |
| 5548 | { "Line/Mic", 0x0 }, |
| 5549 | { "CD", 0x4 }, |
| 5550 | }, |
| 5551 | }, |
| 5552 | { |
| 5553 | .num_items = 3, |
| 5554 | .items = { |
| 5555 | { "Line/Mic", 0x0 }, |
| 5556 | { "CD", 0x4 }, |
| 5557 | { "Mixer", 0x5 }, |
| 5558 | }, |
| 5559 | }, |
| 5560 | }; |
| 5561 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5562 | /* |
| 5563 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5564 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5565 | * element which allows changing the channel mode, so the verb list is |
| 5566 | * never used. |
| 5567 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5568 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5569 | { 2, NULL }, |
| 5570 | }; |
| 5571 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5572 | |
| 5573 | /* Mixer combinations |
| 5574 | * |
| 5575 | * basic: base_output + input + pc_beep + capture |
| 5576 | * HP: base_output + input + capture_alt |
| 5577 | * HP_3013: hp_3013 + input + capture |
| 5578 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5579 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5580 | */ |
| 5581 | |
| 5582 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5583 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5584 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5585 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5586 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5587 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5588 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5589 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5590 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5591 | |
| 5592 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5593 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5594 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5595 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5596 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5597 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5598 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5599 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5600 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5601 | { } /* end */ |
| 5602 | }; |
| 5603 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5604 | /* update HP, line and mono out pins according to the master switch */ |
| 5605 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5606 | hda_nid_t hp, hda_nid_t line, |
| 5607 | hda_nid_t mono) |
| 5608 | { |
| 5609 | struct alc_spec *spec = codec->spec; |
| 5610 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5611 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5612 | snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5613 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5614 | snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5615 | val); |
| 5616 | /* mono (speaker) depending on the HP jack sense */ |
| 5617 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5618 | snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5619 | val); |
| 5620 | } |
| 5621 | |
| 5622 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5623 | struct snd_ctl_elem_value *ucontrol) |
| 5624 | { |
| 5625 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5626 | struct alc_spec *spec = codec->spec; |
| 5627 | *ucontrol->value.integer.value = spec->master_sw; |
| 5628 | return 0; |
| 5629 | } |
| 5630 | |
| 5631 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5632 | struct snd_ctl_elem_value *ucontrol) |
| 5633 | { |
| 5634 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5635 | struct alc_spec *spec = codec->spec; |
| 5636 | int val = !!*ucontrol->value.integer.value; |
| 5637 | hda_nid_t hp, line, mono; |
| 5638 | |
| 5639 | if (val == spec->master_sw) |
| 5640 | return 0; |
| 5641 | spec->master_sw = val; |
| 5642 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5643 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5644 | mono = kcontrol->private_value & 0xff; |
| 5645 | alc260_hp_master_update(codec, hp, line, mono); |
| 5646 | return 1; |
| 5647 | } |
| 5648 | |
| 5649 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5650 | { |
| 5651 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5652 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5653 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5654 | .info = snd_ctl_boolean_mono_info, |
| 5655 | .get = alc260_hp_master_sw_get, |
| 5656 | .put = alc260_hp_master_sw_put, |
| 5657 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5658 | }, |
| 5659 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5660 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5661 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5662 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5663 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5664 | HDA_OUTPUT), |
| 5665 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5666 | { } /* end */ |
| 5667 | }; |
| 5668 | |
| 5669 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5670 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5671 | {}, |
| 5672 | }; |
| 5673 | |
| 5674 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5675 | { |
| 5676 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5677 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5678 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5679 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5680 | } |
| 5681 | |
| 5682 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5683 | { |
| 5684 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5685 | alc260_hp_automute(codec); |
| 5686 | } |
| 5687 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5688 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5689 | { |
| 5690 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5691 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5692 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5693 | .info = snd_ctl_boolean_mono_info, |
| 5694 | .get = alc260_hp_master_sw_get, |
| 5695 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5696 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5697 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5698 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5699 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5700 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5701 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5702 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5703 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5704 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5705 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5706 | { } /* end */ |
| 5707 | }; |
| 5708 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5709 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5710 | .ops = &snd_hda_bind_vol, |
| 5711 | .values = { |
| 5712 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5713 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5714 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5715 | 0 |
| 5716 | }, |
| 5717 | }; |
| 5718 | |
| 5719 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5720 | .ops = &snd_hda_bind_sw, |
| 5721 | .values = { |
| 5722 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5723 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5724 | 0 |
| 5725 | }, |
| 5726 | }; |
| 5727 | |
| 5728 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5729 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5730 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5731 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5732 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5733 | { } /* end */ |
| 5734 | }; |
| 5735 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5736 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5737 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5738 | {}, |
| 5739 | }; |
| 5740 | |
| 5741 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5742 | { |
| 5743 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5744 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5745 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5746 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5747 | } |
| 5748 | |
| 5749 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5750 | unsigned int res) |
| 5751 | { |
| 5752 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5753 | alc260_hp_3013_automute(codec); |
| 5754 | } |
| 5755 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5756 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5757 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5758 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5759 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5760 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5761 | bits); |
| 5762 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5763 | bits); |
| 5764 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5765 | bits); |
| 5766 | } |
| 5767 | |
| 5768 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5769 | unsigned int res) |
| 5770 | { |
| 5771 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5772 | alc260_hp_3012_automute(codec); |
| 5773 | } |
| 5774 | |
| 5775 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5776 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5777 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5778 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5779 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5780 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5781 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5782 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5783 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5784 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5785 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5786 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5787 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5788 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5789 | { } /* end */ |
| 5790 | }; |
| 5791 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5792 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5793 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5794 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5795 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5796 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5797 | * revisions available in early 2006. Therefore for now allow the |
| 5798 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5799 | * that the lack of mic bias for this NID is intentional we could change the |
| 5800 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5801 | * |
| 5802 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5803 | * don't appear to make the mic bias available from the "line" jack, even |
| 5804 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5805 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5806 | * and the output jack. If this turns out to be the case for all such |
| 5807 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5808 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5809 | * |
| 5810 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5811 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5812 | * controls for such models. On models without a "mono speaker" the control |
| 5813 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5814 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5815 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5816 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5817 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5818 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5819 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5820 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5821 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5822 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5823 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5824 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5825 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5826 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5827 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5828 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5829 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5830 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5831 | { } /* end */ |
| 5832 | }; |
| 5833 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5834 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5835 | */ |
| 5836 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5837 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5838 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5839 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5840 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5841 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5842 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5843 | { } /* end */ |
| 5844 | }; |
| 5845 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5846 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5847 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5848 | */ |
| 5849 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5850 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5851 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5852 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5853 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5854 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5855 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5856 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5857 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5858 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5859 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5860 | { } /* end */ |
| 5861 | }; |
| 5862 | |
| 5863 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5864 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5865 | */ |
| 5866 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5867 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5868 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5869 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5870 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5871 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5872 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5873 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5874 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5875 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5876 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5877 | { } /* end */ |
| 5878 | }; |
| 5879 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5880 | /* |
| 5881 | * initialization verbs |
| 5882 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5883 | static struct hda_verb alc260_init_verbs[] = { |
| 5884 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5885 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5886 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5887 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5888 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5889 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5890 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5891 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5892 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5893 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5894 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5895 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5896 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5897 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5898 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5899 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5900 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5901 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5902 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5903 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5904 | /* set connection select to line in (default select for this ADC) */ |
| 5905 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5906 | /* mute capture amp left and right */ |
| 5907 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5908 | /* set connection select to line in (default select for this ADC) */ |
| 5909 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5910 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5911 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5912 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5913 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5914 | /* set vol=0 HP mixer amp left and right */ |
| 5915 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5916 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5917 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5918 | /* set vol=0 Mono mixer amp left and right */ |
| 5919 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5920 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5921 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5922 | /* unmute LINE-2 out pin */ |
| 5923 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5924 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5925 | * Line In 2 = 0x03 |
| 5926 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5927 | /* mute analog inputs */ |
| 5928 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5929 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5930 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5931 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5932 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5933 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5934 | /* mute Front out path */ |
| 5935 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5936 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5937 | /* mute Headphone out path */ |
| 5938 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5939 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5940 | /* mute Mono out path */ |
| 5941 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5942 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5943 | { } |
| 5944 | }; |
| 5945 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5946 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5947 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5948 | /* Headphone and output */ |
| 5949 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5950 | /* mono output */ |
| 5951 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5952 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5953 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5954 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5955 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5956 | /* Line In pin widget for input */ |
| 5957 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5958 | /* Line-2 pin widget for output */ |
| 5959 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5960 | /* CD pin widget for input */ |
| 5961 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5962 | /* unmute amp left and right */ |
| 5963 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5964 | /* set connection select to line in (default select for this ADC) */ |
| 5965 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5966 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5967 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5968 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5969 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5970 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5971 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5972 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5973 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5974 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5975 | * Line In 2 = 0x03 |
| 5976 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5977 | /* mute analog inputs */ |
| 5978 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5979 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5980 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5981 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5982 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5983 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5984 | /* Unmute Front out path */ |
| 5985 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5986 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5987 | /* Unmute Headphone out path */ |
| 5988 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5989 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5990 | /* Unmute Mono out path */ |
| 5991 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5992 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5993 | { } |
| 5994 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5995 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5996 | |
| 5997 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5998 | /* Line out and output */ |
| 5999 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6000 | /* mono output */ |
| 6001 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6002 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6003 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6004 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6005 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6006 | /* Line In pin widget for input */ |
| 6007 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6008 | /* Headphone pin widget for output */ |
| 6009 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6010 | /* CD pin widget for input */ |
| 6011 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6012 | /* unmute amp left and right */ |
| 6013 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6014 | /* set connection select to line in (default select for this ADC) */ |
| 6015 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6016 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6017 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6018 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6019 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6020 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6021 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6022 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6023 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6024 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6025 | * Line In 2 = 0x03 |
| 6026 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6027 | /* mute analog inputs */ |
| 6028 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6029 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6030 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6031 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6032 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6033 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6034 | /* Unmute Front out path */ |
| 6035 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6036 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6037 | /* Unmute Headphone out path */ |
| 6038 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6039 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6040 | /* Unmute Mono out path */ |
| 6041 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6042 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6043 | { } |
| 6044 | }; |
| 6045 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6046 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6047 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6048 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6049 | */ |
| 6050 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 6051 | /* Disable all GPIOs */ |
| 6052 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6053 | /* Internal speaker is connected to headphone pin */ |
| 6054 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6055 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6056 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6057 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6058 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6059 | /* Ensure all other unused pins are disabled and muted. */ |
| 6060 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6061 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6062 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6063 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6064 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6065 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6066 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6067 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6068 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6069 | /* Disable digital (SPDIF) pins */ |
| 6070 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6071 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6072 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6073 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6074 | * when acting as an output. |
| 6075 | */ |
| 6076 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6077 | |
| 6078 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6079 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6080 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6081 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6082 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6083 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6084 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6085 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6086 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6087 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6088 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6089 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6090 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6091 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6092 | * If the pin mode is changed by the user the pin mode control will |
| 6093 | * take care of enabling the pin's input/output buffers as needed. |
| 6094 | * Therefore there's no need to enable the input buffer at this |
| 6095 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6096 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6097 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6098 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6099 | * mixer ctrl) |
| 6100 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6101 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6102 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6103 | /* Mute capture amp left and right */ |
| 6104 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6105 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6106 | * in (on mic1 pin) |
| 6107 | */ |
| 6108 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6109 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6110 | /* Do the same for the second ADC: mute capture input amp and |
| 6111 | * set ADC connection to line in (on mic1 pin) |
| 6112 | */ |
| 6113 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6114 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6115 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6116 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6117 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6118 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6119 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6120 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6121 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6122 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6123 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6124 | {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] | 6125 | |
| 6126 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6127 | }; |
| 6128 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6129 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6130 | * similar laptops (adapted from Fujitsu init verbs). |
| 6131 | */ |
| 6132 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 6133 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6134 | * the headphone jack. Turn this on and rely on the standard mute |
| 6135 | * methods whenever the user wants to turn these outputs off. |
| 6136 | */ |
| 6137 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6138 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6139 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6140 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6141 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6142 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6143 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6144 | /* Line In jack is connected to Line1 pin */ |
| 6145 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6146 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6147 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6148 | /* Ensure all other unused pins are disabled and muted. */ |
| 6149 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6150 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6151 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6152 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6153 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6154 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6155 | /* Disable digital (SPDIF) pins */ |
| 6156 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6157 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6158 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6159 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6160 | * bus when acting as outputs. |
| 6161 | */ |
| 6162 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6163 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6164 | |
| 6165 | /* Start with output sum widgets muted and their output gains at min */ |
| 6166 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6167 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6168 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6169 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6170 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6171 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6172 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6173 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6174 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6175 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6176 | /* Unmute Line-out pin widget amp left and right |
| 6177 | * (no equiv mixer ctrl) |
| 6178 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6179 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6180 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6181 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6182 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6183 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6184 | * will take care of enabling the pin's input/output buffers as needed. |
| 6185 | * Therefore there's no need to enable the input buffer at this |
| 6186 | * stage. |
| 6187 | */ |
| 6188 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6189 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6190 | |
| 6191 | /* Mute capture amp left and right */ |
| 6192 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6193 | /* Set ADC connection select to match default mixer setting - mic |
| 6194 | * (on mic1 pin) |
| 6195 | */ |
| 6196 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6197 | |
| 6198 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6199 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6200 | */ |
| 6201 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6202 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6203 | |
| 6204 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6205 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6206 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6207 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6208 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6209 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6210 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6211 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6212 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6213 | |
| 6214 | { } |
| 6215 | }; |
| 6216 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6217 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6218 | * (adapted from Acer init verbs). |
| 6219 | */ |
| 6220 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6221 | /* GPIO 0 enables the output jack. |
| 6222 | * Turn this on and rely on the standard mute |
| 6223 | * methods whenever the user wants to turn these outputs off. |
| 6224 | */ |
| 6225 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6226 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6227 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6228 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6229 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6230 | /* Ensure all other unused pins are disabled and muted. */ |
| 6231 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6232 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6233 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6234 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6235 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6236 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6237 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6238 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6239 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6240 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6241 | /* Disable digital (SPDIF) pins */ |
| 6242 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6243 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6244 | |
| 6245 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6246 | * bus when acting as outputs. |
| 6247 | */ |
| 6248 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6249 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6250 | |
| 6251 | /* Start with output sum widgets muted and their output gains at min */ |
| 6252 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6253 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6254 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6255 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6256 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6257 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6258 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6259 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6260 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6261 | |
| 6262 | /* Unmute Line-out pin widget amp left and right |
| 6263 | * (no equiv mixer ctrl) |
| 6264 | */ |
| 6265 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6266 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6267 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6268 | * will take care of enabling the pin's input/output buffers as needed. |
| 6269 | * Therefore there's no need to enable the input buffer at this |
| 6270 | * stage. |
| 6271 | */ |
| 6272 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6273 | |
| 6274 | /* Mute capture amp left and right */ |
| 6275 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6276 | /* Set ADC connection select to match default mixer setting - mic |
| 6277 | * (on mic1 pin) |
| 6278 | */ |
| 6279 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6280 | |
| 6281 | /* Do similar with the second ADC: mute capture input amp and |
| 6282 | * set ADC connection to mic to match ALSA's default state. |
| 6283 | */ |
| 6284 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6285 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6286 | |
| 6287 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6288 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6289 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6290 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6291 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6292 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6293 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6294 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6295 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6296 | |
| 6297 | { } |
| 6298 | }; |
| 6299 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6300 | static struct hda_verb alc260_will_verbs[] = { |
| 6301 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6302 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6303 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6304 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6305 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6306 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6307 | {} |
| 6308 | }; |
| 6309 | |
| 6310 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6311 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6312 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6313 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6314 | |
| 6315 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6316 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6317 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6318 | |
| 6319 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6320 | {} |
| 6321 | }; |
| 6322 | |
| 6323 | /* toggle speaker-output according to the hp-jack state */ |
| 6324 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6325 | { |
| 6326 | unsigned int present; |
| 6327 | |
| 6328 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6329 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6330 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6331 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6332 | AC_VERB_SET_GPIO_DATA, 1); |
| 6333 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6334 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6335 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6336 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6337 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6338 | AC_VERB_SET_GPIO_DATA, 0); |
| 6339 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6340 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6341 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6342 | } |
| 6343 | } |
| 6344 | |
| 6345 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6346 | unsigned int res) |
| 6347 | { |
| 6348 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6349 | alc260_replacer_672v_automute(codec); |
| 6350 | } |
| 6351 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6352 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6353 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6354 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6355 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6356 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6357 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6358 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6359 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6360 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6361 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6362 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6363 | {} |
| 6364 | }; |
| 6365 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6366 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6367 | * configuration. |
| 6368 | */ |
| 6369 | #ifdef CONFIG_SND_DEBUG |
| 6370 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6371 | 0x02, |
| 6372 | }; |
| 6373 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6374 | 0x04, 0x05, |
| 6375 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6376 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6377 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6378 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6379 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6380 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6381 | { |
| 6382 | .num_items = 7, |
| 6383 | .items = { |
| 6384 | { "MIC1 pin", 0x0 }, |
| 6385 | { "MIC2 pin", 0x1 }, |
| 6386 | { "LINE1 pin", 0x2 }, |
| 6387 | { "LINE2 pin", 0x3 }, |
| 6388 | { "CD pin", 0x4 }, |
| 6389 | { "LINE-OUT pin", 0x5 }, |
| 6390 | { "HP-OUT pin", 0x6 }, |
| 6391 | }, |
| 6392 | }, |
| 6393 | { |
| 6394 | .num_items = 8, |
| 6395 | .items = { |
| 6396 | { "MIC1 pin", 0x0 }, |
| 6397 | { "MIC2 pin", 0x1 }, |
| 6398 | { "LINE1 pin", 0x2 }, |
| 6399 | { "LINE2 pin", 0x3 }, |
| 6400 | { "CD pin", 0x4 }, |
| 6401 | { "Mixer", 0x5 }, |
| 6402 | { "LINE-OUT pin", 0x6 }, |
| 6403 | { "HP-OUT pin", 0x7 }, |
| 6404 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6405 | }, |
| 6406 | }; |
| 6407 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6408 | /* Output driver widgets */ |
| 6409 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6410 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6411 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6412 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6413 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6414 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6415 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6416 | /* Modes for retasking pin widgets |
| 6417 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6418 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6419 | * mention this restriction. At this stage it's not clear whether |
| 6420 | * this behaviour is intentional or is a hardware bug in chip |
| 6421 | * revisions available at least up until early 2006. Therefore for |
| 6422 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6423 | * choices, but if it turns out that the lack of mic bias for these |
| 6424 | * NIDs is intentional we could change their modes from |
| 6425 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6426 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6427 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6428 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6429 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6430 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6431 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6432 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6433 | |
| 6434 | /* Loopback mixer controls */ |
| 6435 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6436 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6437 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6438 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6439 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6440 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6441 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6442 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6443 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6444 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6445 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6446 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6447 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6448 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6449 | |
| 6450 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6451 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6452 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6453 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6454 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6455 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6456 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6457 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6458 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6459 | */ |
| 6460 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6461 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6462 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6463 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6464 | * this output to turn on an external amplifier. |
| 6465 | */ |
| 6466 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6467 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6468 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6469 | { } /* end */ |
| 6470 | }; |
| 6471 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6472 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6473 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6474 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6475 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6476 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6477 | /* Enable retasking pins as output, initially without power amp */ |
| 6478 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6479 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6480 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6481 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6482 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6483 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6484 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6485 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6486 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6487 | * payload also sets the generation to 0, output to be in "consumer" |
| 6488 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6489 | * control. |
| 6490 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6491 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6492 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6493 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6494 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6495 | * OUT1 sum bus when acting as an output. |
| 6496 | */ |
| 6497 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6498 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6499 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6500 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6501 | |
| 6502 | /* Start with output sum widgets muted and their output gains at min */ |
| 6503 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6504 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6505 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6506 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6507 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6508 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6509 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6510 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6511 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6512 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6513 | /* Unmute retasking pin widget output buffers since the default |
| 6514 | * state appears to be output. As the pin mode is changed by the |
| 6515 | * user the pin mode control will take care of enabling the pin's |
| 6516 | * input/output buffers as needed. |
| 6517 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6518 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6519 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6520 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6521 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6522 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6523 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6524 | /* Also unmute the mono-out pin widget */ |
| 6525 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6526 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6527 | /* Mute capture amp left and right */ |
| 6528 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6529 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6530 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6531 | */ |
| 6532 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6533 | |
| 6534 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6535 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6536 | */ |
| 6537 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6538 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6539 | |
| 6540 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6541 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6542 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6543 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6544 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6545 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6546 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6547 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6548 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6549 | |
| 6550 | { } |
| 6551 | }; |
| 6552 | #endif |
| 6553 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6554 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6555 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6556 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6557 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6558 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6559 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6560 | /* |
| 6561 | * for BIOS auto-configuration |
| 6562 | */ |
| 6563 | |
| 6564 | 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] | 6565 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6566 | { |
| 6567 | hda_nid_t nid_vol; |
| 6568 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6569 | int err; |
| 6570 | |
| 6571 | if (nid >= 0x0f && nid < 0x11) { |
| 6572 | nid_vol = nid - 0x7; |
| 6573 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6574 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6575 | } else if (nid == 0x11) { |
| 6576 | nid_vol = nid - 0x7; |
| 6577 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6578 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6579 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6580 | nid_vol = 0x08; |
| 6581 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6582 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6583 | } else |
| 6584 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6585 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6586 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6587 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6588 | 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] | 6589 | if (err < 0) |
| 6590 | return err; |
| 6591 | *vol_bits |= (1 << nid_vol); |
| 6592 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6593 | 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] | 6594 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6595 | return err; |
| 6596 | return 1; |
| 6597 | } |
| 6598 | |
| 6599 | /* add playback controls from the parsed DAC table */ |
| 6600 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6601 | const struct auto_pin_cfg *cfg) |
| 6602 | { |
| 6603 | hda_nid_t nid; |
| 6604 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6605 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6606 | |
| 6607 | spec->multiout.num_dacs = 1; |
| 6608 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6609 | spec->multiout.dac_nids[0] = 0x02; |
| 6610 | |
| 6611 | nid = cfg->line_out_pins[0]; |
| 6612 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6613 | const char *pfx; |
| 6614 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6615 | pfx = "Master"; |
| 6616 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6617 | pfx = "Speaker"; |
| 6618 | else |
| 6619 | pfx = "Front"; |
| 6620 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6621 | if (err < 0) |
| 6622 | return err; |
| 6623 | } |
| 6624 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6625 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6626 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6627 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6628 | if (err < 0) |
| 6629 | return err; |
| 6630 | } |
| 6631 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6632 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6633 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6634 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6635 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6636 | if (err < 0) |
| 6637 | return err; |
| 6638 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6639 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6640 | } |
| 6641 | |
| 6642 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6643 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6644 | const struct auto_pin_cfg *cfg) |
| 6645 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6646 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6647 | } |
| 6648 | |
| 6649 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6650 | hda_nid_t nid, int pin_type, |
| 6651 | int sel_idx) |
| 6652 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6653 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6654 | /* need the manual connection? */ |
| 6655 | if (nid >= 0x12) { |
| 6656 | int idx = nid - 0x12; |
| 6657 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6658 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6659 | } |
| 6660 | } |
| 6661 | |
| 6662 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6663 | { |
| 6664 | struct alc_spec *spec = codec->spec; |
| 6665 | hda_nid_t nid; |
| 6666 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6667 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6668 | if (nid) { |
| 6669 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6670 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6671 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6672 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6673 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6674 | if (nid) |
| 6675 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6676 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6677 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6678 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6679 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6680 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6681 | |
| 6682 | #define ALC260_PIN_CD_NID 0x16 |
| 6683 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6684 | { |
| 6685 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 6686 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6687 | int i; |
| 6688 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 6689 | for (i = 0; i < cfg->num_inputs; i++) { |
| 6690 | hda_nid_t nid = cfg->inputs[i].pin; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6691 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6692 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6693 | if (nid != ALC260_PIN_CD_NID && |
| 6694 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6695 | snd_hda_codec_write(codec, nid, 0, |
| 6696 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6697 | AMP_OUT_MUTE); |
| 6698 | } |
| 6699 | } |
| 6700 | } |
| 6701 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6702 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 6703 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6704 | /* |
| 6705 | * generic initialization of ADC, input mixers and output mixers |
| 6706 | */ |
| 6707 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6708 | /* |
| 6709 | * Unmute ADC0-1 and set the default input to mic-in |
| 6710 | */ |
| 6711 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6712 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6713 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6714 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6715 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6716 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6717 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6718 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6719 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6720 | */ |
| 6721 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6722 | /* mute analog inputs */ |
| 6723 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6724 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6725 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6726 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6727 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6728 | |
| 6729 | /* |
| 6730 | * Set up output mixers (0x08 - 0x0a) |
| 6731 | */ |
| 6732 | /* set vol=0 to output mixers */ |
| 6733 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6734 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6735 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6736 | /* set up input amps for analog loopback */ |
| 6737 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6738 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6739 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6740 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6741 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6742 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6743 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6744 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6745 | { } |
| 6746 | }; |
| 6747 | |
| 6748 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6749 | { |
| 6750 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6751 | int err; |
| 6752 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6753 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6754 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6755 | alc260_ignore); |
| 6756 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6757 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6758 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6759 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6760 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6761 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6762 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6763 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6764 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6765 | return err; |
| 6766 | |
| 6767 | spec->multiout.max_channels = 2; |
| 6768 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6769 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6770 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6771 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6772 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6773 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6774 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6775 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6776 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6777 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6778 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 6779 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6780 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6781 | return 1; |
| 6782 | } |
| 6783 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6784 | /* additional initialization for auto-configuration model */ |
| 6785 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6786 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6787 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6788 | alc260_auto_init_multi_out(codec); |
| 6789 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6790 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 6791 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6792 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6793 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6794 | } |
| 6795 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6796 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6797 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6798 | { 0x07, HDA_INPUT, 0 }, |
| 6799 | { 0x07, HDA_INPUT, 1 }, |
| 6800 | { 0x07, HDA_INPUT, 2 }, |
| 6801 | { 0x07, HDA_INPUT, 3 }, |
| 6802 | { 0x07, HDA_INPUT, 4 }, |
| 6803 | { } /* end */ |
| 6804 | }; |
| 6805 | #endif |
| 6806 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6807 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 6808 | * Pin config fixes |
| 6809 | */ |
| 6810 | enum { |
| 6811 | PINFIX_HP_DC5750, |
| 6812 | }; |
| 6813 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 6814 | static const struct alc_fixup alc260_fixups[] = { |
| 6815 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 6816 | .pins = (const struct alc_pincfg[]) { |
| 6817 | { 0x11, 0x90130110 }, /* speaker */ |
| 6818 | { } |
| 6819 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 6820 | }, |
| 6821 | }; |
| 6822 | |
| 6823 | static struct snd_pci_quirk alc260_fixup_tbl[] = { |
| 6824 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 6825 | {} |
| 6826 | }; |
| 6827 | |
| 6828 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6829 | * ALC260 configurations |
| 6830 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6831 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6832 | [ALC260_BASIC] = "basic", |
| 6833 | [ALC260_HP] = "hp", |
| 6834 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6835 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6836 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6837 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6838 | [ALC260_WILL] = "will", |
| 6839 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6840 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6841 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6842 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6843 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6844 | [ALC260_AUTO] = "auto", |
| 6845 | }; |
| 6846 | |
| 6847 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6848 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 6849 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6850 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6851 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6852 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 6853 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6854 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6855 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6856 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6857 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6858 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6859 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6860 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6861 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6862 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6863 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6864 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6865 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6866 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6867 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6868 | {} |
| 6869 | }; |
| 6870 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6871 | static struct alc_config_preset alc260_presets[] = { |
| 6872 | [ALC260_BASIC] = { |
| 6873 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6874 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6875 | .init_verbs = { alc260_init_verbs }, |
| 6876 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6877 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6878 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 6879 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6880 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6881 | .channel_mode = alc260_modes, |
| 6882 | .input_mux = &alc260_capture_source, |
| 6883 | }, |
| 6884 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6885 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6886 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6887 | .init_verbs = { alc260_init_verbs, |
| 6888 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6889 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6890 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6891 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6892 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6893 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6894 | .channel_mode = alc260_modes, |
| 6895 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6896 | .unsol_event = alc260_hp_unsol_event, |
| 6897 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6898 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6899 | [ALC260_HP_DC7600] = { |
| 6900 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6901 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6902 | .init_verbs = { alc260_init_verbs, |
| 6903 | alc260_hp_dc7600_verbs }, |
| 6904 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6905 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6906 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6907 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6908 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6909 | .channel_mode = alc260_modes, |
| 6910 | .input_mux = &alc260_capture_source, |
| 6911 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6912 | .init_hook = alc260_hp_3012_automute, |
| 6913 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6914 | [ALC260_HP_3013] = { |
| 6915 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6916 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6917 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6918 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6919 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6920 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6921 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6922 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6923 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6924 | .channel_mode = alc260_modes, |
| 6925 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6926 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6927 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6928 | }, |
| 6929 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6930 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6931 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6932 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6933 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6934 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6935 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6936 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6937 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6938 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6939 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6940 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6941 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6942 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6943 | .init_verbs = { alc260_acer_init_verbs }, |
| 6944 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6945 | .dac_nids = alc260_dac_nids, |
| 6946 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6947 | .adc_nids = alc260_dual_adc_nids, |
| 6948 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6949 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6950 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6951 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6952 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6953 | [ALC260_FAVORIT100] = { |
| 6954 | .mixers = { alc260_favorit100_mixer }, |
| 6955 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6956 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6957 | .dac_nids = alc260_dac_nids, |
| 6958 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6959 | .adc_nids = alc260_dual_adc_nids, |
| 6960 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6961 | .channel_mode = alc260_modes, |
| 6962 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6963 | .input_mux = alc260_favorit100_capture_sources, |
| 6964 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6965 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6966 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6967 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6968 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6969 | .dac_nids = alc260_dac_nids, |
| 6970 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6971 | .adc_nids = alc260_adc_nids, |
| 6972 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6973 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6974 | .channel_mode = alc260_modes, |
| 6975 | .input_mux = &alc260_capture_source, |
| 6976 | }, |
| 6977 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6978 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6979 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6980 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6981 | .dac_nids = alc260_dac_nids, |
| 6982 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6983 | .adc_nids = alc260_adc_nids, |
| 6984 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6985 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6986 | .channel_mode = alc260_modes, |
| 6987 | .input_mux = &alc260_capture_source, |
| 6988 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6989 | .init_hook = alc260_replacer_672v_automute, |
| 6990 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6991 | #ifdef CONFIG_SND_DEBUG |
| 6992 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6993 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6994 | .init_verbs = { alc260_test_init_verbs }, |
| 6995 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6996 | .dac_nids = alc260_test_dac_nids, |
| 6997 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6998 | .adc_nids = alc260_test_adc_nids, |
| 6999 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7000 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7001 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 7002 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7003 | }, |
| 7004 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7005 | }; |
| 7006 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7007 | static int patch_alc260(struct hda_codec *codec) |
| 7008 | { |
| 7009 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7010 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7011 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7012 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7013 | if (spec == NULL) |
| 7014 | return -ENOMEM; |
| 7015 | |
| 7016 | codec->spec = spec; |
| 7017 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7018 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7019 | alc260_models, |
| 7020 | alc260_cfg_tbl); |
| 7021 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7022 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7023 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7024 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7025 | } |
| 7026 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7027 | if (board_config == ALC260_AUTO) |
| 7028 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1); |
| 7029 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7030 | if (board_config == ALC260_AUTO) { |
| 7031 | /* automatic parse from the BIOS config */ |
| 7032 | err = alc260_parse_auto_config(codec); |
| 7033 | if (err < 0) { |
| 7034 | alc_free(codec); |
| 7035 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7036 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7037 | printk(KERN_INFO |
| 7038 | "hda_codec: Cannot set up configuration " |
| 7039 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7040 | board_config = ALC260_BASIC; |
| 7041 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7042 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7043 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7044 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7045 | if (err < 0) { |
| 7046 | alc_free(codec); |
| 7047 | return err; |
| 7048 | } |
| 7049 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7050 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7051 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7052 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7053 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7054 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7055 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7056 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7057 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7058 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7059 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7060 | if (!spec->adc_nids && spec->input_mux) { |
| 7061 | /* check whether NID 0x04 is valid */ |
| 7062 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7063 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7064 | /* get type */ |
| 7065 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7066 | spec->adc_nids = alc260_adc_nids_alt; |
| 7067 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7068 | } else { |
| 7069 | spec->adc_nids = alc260_adc_nids; |
| 7070 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7071 | } |
| 7072 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7073 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7074 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7075 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7076 | if (board_config == ALC260_AUTO) |
| 7077 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0); |
| 7078 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7079 | spec->vmaster_nid = 0x08; |
| 7080 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7081 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7082 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7083 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7084 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7085 | if (!spec->loopback.amplist) |
| 7086 | spec->loopback.amplist = alc260_loopbacks; |
| 7087 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7088 | |
| 7089 | return 0; |
| 7090 | } |
| 7091 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7092 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7093 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7094 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7095 | * |
| 7096 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7097 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7098 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7099 | * 6-channel independent captures. |
| 7100 | * |
| 7101 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7102 | * driver yet). |
| 7103 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7104 | #define ALC882_DIGOUT_NID 0x06 |
| 7105 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7106 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7107 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7108 | #define ALC1200_DIGOUT_NID 0x10 |
| 7109 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7110 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7111 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7112 | { 8, NULL } |
| 7113 | }; |
| 7114 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7115 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7116 | static hda_nid_t alc882_dac_nids[4] = { |
| 7117 | /* front, rear, clfe, rear_surr */ |
| 7118 | 0x02, 0x03, 0x04, 0x05 |
| 7119 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7120 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7121 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7122 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7123 | #define alc882_adc_nids alc880_adc_nids |
| 7124 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7125 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7126 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7127 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7128 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7129 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7130 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7131 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7132 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7133 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7134 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7135 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7136 | /* input MUX */ |
| 7137 | /* FIXME: should be a matrix-type input source selection */ |
| 7138 | |
| 7139 | static struct hda_input_mux alc882_capture_source = { |
| 7140 | .num_items = 4, |
| 7141 | .items = { |
| 7142 | { "Mic", 0x0 }, |
| 7143 | { "Front Mic", 0x1 }, |
| 7144 | { "Line", 0x2 }, |
| 7145 | { "CD", 0x4 }, |
| 7146 | }, |
| 7147 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7148 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7149 | #define alc883_capture_source alc882_capture_source |
| 7150 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7151 | static struct hda_input_mux alc889_capture_source = { |
| 7152 | .num_items = 3, |
| 7153 | .items = { |
| 7154 | { "Front Mic", 0x0 }, |
| 7155 | { "Mic", 0x3 }, |
| 7156 | { "Line", 0x2 }, |
| 7157 | }, |
| 7158 | }; |
| 7159 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7160 | static struct hda_input_mux mb5_capture_source = { |
| 7161 | .num_items = 3, |
| 7162 | .items = { |
| 7163 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7164 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7165 | { "CD", 0x4 }, |
| 7166 | }, |
| 7167 | }; |
| 7168 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7169 | static struct hda_input_mux macmini3_capture_source = { |
| 7170 | .num_items = 2, |
| 7171 | .items = { |
| 7172 | { "Line", 0x2 }, |
| 7173 | { "CD", 0x4 }, |
| 7174 | }, |
| 7175 | }; |
| 7176 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7177 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7178 | .num_items = 4, |
| 7179 | .items = { |
| 7180 | { "Mic", 0x1 }, |
| 7181 | { "Front Mic", 0x0 }, |
| 7182 | { "Line", 0x2 }, |
| 7183 | { "CD", 0x4 }, |
| 7184 | }, |
| 7185 | }; |
| 7186 | |
| 7187 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7188 | .num_items = 2, |
| 7189 | .items = { |
| 7190 | { "Mic", 0x1 }, |
| 7191 | { "Line", 0x2 }, |
| 7192 | }, |
| 7193 | }; |
| 7194 | |
| 7195 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7196 | .num_items = 4, |
| 7197 | .items = { |
| 7198 | { "Mic", 0x0 }, |
David Henningsson | 150b432 | 2010-07-29 14:46:42 +0200 | [diff] [blame] | 7199 | { "Int Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7200 | { "Line", 0x2 }, |
| 7201 | { "CD", 0x4 }, |
| 7202 | }, |
| 7203 | }; |
| 7204 | |
| 7205 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7206 | .num_items = 2, |
| 7207 | .items = { |
| 7208 | { "Mic", 0x0 }, |
| 7209 | { "Int Mic", 0x1 }, |
| 7210 | }, |
| 7211 | }; |
| 7212 | |
| 7213 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7214 | .num_items = 3, |
| 7215 | .items = { |
| 7216 | { "Mic", 0x0 }, |
| 7217 | { "Front Mic", 0x1 }, |
| 7218 | { "Line", 0x4 }, |
| 7219 | }, |
| 7220 | }; |
| 7221 | |
| 7222 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7223 | .num_items = 2, |
| 7224 | .items = { |
| 7225 | { "Mic", 0x0 }, |
| 7226 | { "Line", 0x2 }, |
| 7227 | }, |
| 7228 | }; |
| 7229 | |
| 7230 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7231 | .num_items = 2, |
| 7232 | .items = { |
| 7233 | { "Mic", 0x0 }, |
| 7234 | /* Front Mic (0x01) unused */ |
| 7235 | { "Line", 0x2 }, |
| 7236 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7237 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7238 | }, |
| 7239 | }; |
| 7240 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7241 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7242 | .num_items = 2, |
| 7243 | .items = { |
| 7244 | { "Mic", 0x01 }, |
| 7245 | { "Line", 0x2 }, /* Not sure! */ |
| 7246 | }, |
| 7247 | }; |
| 7248 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7249 | /* |
| 7250 | * 2ch mode |
| 7251 | */ |
| 7252 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7253 | { 2, NULL } |
| 7254 | }; |
| 7255 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7256 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7257 | * 2ch mode |
| 7258 | */ |
| 7259 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7260 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7261 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7262 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7263 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7264 | { } /* end */ |
| 7265 | }; |
| 7266 | |
| 7267 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7268 | * 4ch mode |
| 7269 | */ |
| 7270 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7271 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7272 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7273 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7274 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7275 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7276 | { } /* end */ |
| 7277 | }; |
| 7278 | |
| 7279 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7280 | * 6ch mode |
| 7281 | */ |
| 7282 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7283 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7284 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7285 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7286 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7287 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7288 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7289 | { } /* end */ |
| 7290 | }; |
| 7291 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7292 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7293 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7294 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7295 | { 6, alc882_3ST_ch6_init }, |
| 7296 | }; |
| 7297 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7298 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7299 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7300 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7301 | * 2ch mode |
| 7302 | */ |
| 7303 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7304 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7305 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7306 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7307 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7308 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7309 | { } /* end */ |
| 7310 | }; |
| 7311 | |
| 7312 | /* |
| 7313 | * 4ch mode |
| 7314 | */ |
| 7315 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7316 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7317 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7318 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7319 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7320 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7321 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7322 | { } /* end */ |
| 7323 | }; |
| 7324 | |
| 7325 | /* |
| 7326 | * 6ch mode |
| 7327 | */ |
| 7328 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7329 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7330 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7331 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7332 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7333 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7334 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7335 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7336 | { } /* end */ |
| 7337 | }; |
| 7338 | |
| 7339 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7340 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7341 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7342 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7343 | }; |
| 7344 | |
| 7345 | |
| 7346 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7347 | * 6ch mode |
| 7348 | */ |
| 7349 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7350 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7351 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7352 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7353 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7354 | { } /* end */ |
| 7355 | }; |
| 7356 | |
| 7357 | /* |
| 7358 | * 8ch mode |
| 7359 | */ |
| 7360 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7361 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7362 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7363 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7364 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7365 | { } /* end */ |
| 7366 | }; |
| 7367 | |
| 7368 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7369 | { 6, alc882_sixstack_ch6_init }, |
| 7370 | { 8, alc882_sixstack_ch8_init }, |
| 7371 | }; |
| 7372 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7373 | |
| 7374 | /* Macbook Air 2,1 */ |
| 7375 | |
| 7376 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7377 | { 2, NULL }, |
| 7378 | }; |
| 7379 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7380 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7381 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7382 | */ |
| 7383 | |
| 7384 | /* |
| 7385 | * 2ch mode |
| 7386 | */ |
| 7387 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7388 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7389 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7390 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7391 | { } /* end */ |
| 7392 | }; |
| 7393 | |
| 7394 | /* |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7395 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7396 | */ |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7397 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7398 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7399 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7400 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7401 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7402 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7403 | { } /* end */ |
| 7404 | }; |
| 7405 | |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7406 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7407 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7408 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7409 | }; |
| 7410 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7411 | /* |
| 7412 | * 2ch |
| 7413 | * Speakers/Woofer/HP = Front |
| 7414 | * LineIn = Input |
| 7415 | */ |
| 7416 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7417 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7418 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7419 | { } /* end */ |
| 7420 | }; |
| 7421 | |
| 7422 | /* |
| 7423 | * 6ch mode |
| 7424 | * Speakers/HP = Front |
| 7425 | * Woofer = LFE |
| 7426 | * LineIn = Surround |
| 7427 | */ |
| 7428 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7429 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7430 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7431 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7432 | { } /* end */ |
| 7433 | }; |
| 7434 | |
| 7435 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7436 | { 2, alc885_mb5_ch2_init }, |
| 7437 | { 6, alc885_mb5_ch6_init }, |
| 7438 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7439 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7440 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7441 | |
| 7442 | /* |
| 7443 | * 2ch mode |
| 7444 | */ |
| 7445 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7446 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7447 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7448 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7449 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7450 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7451 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7452 | { } /* end */ |
| 7453 | }; |
| 7454 | |
| 7455 | /* |
| 7456 | * 4ch mode |
| 7457 | */ |
| 7458 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7459 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7460 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7461 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7462 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7463 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7464 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7465 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7466 | { } /* end */ |
| 7467 | }; |
| 7468 | |
| 7469 | /* |
| 7470 | * 6ch mode |
| 7471 | */ |
| 7472 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7473 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7474 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7475 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7476 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7477 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7478 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7479 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7480 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7481 | { } /* end */ |
| 7482 | }; |
| 7483 | |
| 7484 | /* |
| 7485 | * 8ch mode |
| 7486 | */ |
| 7487 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7488 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7489 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7490 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7491 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7492 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7493 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7494 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7495 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7496 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7497 | { } /* end */ |
| 7498 | }; |
| 7499 | |
| 7500 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7501 | { 2, alc883_4ST_ch2_init }, |
| 7502 | { 4, alc883_4ST_ch4_init }, |
| 7503 | { 6, alc883_4ST_ch6_init }, |
| 7504 | { 8, alc883_4ST_ch8_init }, |
| 7505 | }; |
| 7506 | |
| 7507 | |
| 7508 | /* |
| 7509 | * 2ch mode |
| 7510 | */ |
| 7511 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7512 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7513 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7514 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7515 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7516 | { } /* end */ |
| 7517 | }; |
| 7518 | |
| 7519 | /* |
| 7520 | * 4ch mode |
| 7521 | */ |
| 7522 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7523 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7524 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7525 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7526 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7527 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7528 | { } /* end */ |
| 7529 | }; |
| 7530 | |
| 7531 | /* |
| 7532 | * 6ch mode |
| 7533 | */ |
| 7534 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7535 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7536 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7537 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7538 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7539 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7540 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7541 | { } /* end */ |
| 7542 | }; |
| 7543 | |
| 7544 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7545 | { 2, alc883_3ST_ch2_intel_init }, |
| 7546 | { 4, alc883_3ST_ch4_intel_init }, |
| 7547 | { 6, alc883_3ST_ch6_intel_init }, |
| 7548 | }; |
| 7549 | |
| 7550 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7551 | * 2ch mode |
| 7552 | */ |
| 7553 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7554 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7555 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7556 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7557 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7558 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7559 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7560 | { } /* end */ |
| 7561 | }; |
| 7562 | |
| 7563 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7564 | * 6ch mode |
| 7565 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7566 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7567 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7568 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7569 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7570 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7571 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7572 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7573 | { } /* end */ |
| 7574 | }; |
| 7575 | |
| 7576 | /* |
| 7577 | * 8ch mode |
| 7578 | */ |
| 7579 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7580 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7581 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7582 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7583 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7584 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7585 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7586 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7587 | { } /* end */ |
| 7588 | }; |
| 7589 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7590 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7591 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7592 | { 6, alc889_ch6_intel_init }, |
| 7593 | { 8, alc889_ch8_intel_init }, |
| 7594 | }; |
| 7595 | |
| 7596 | /* |
| 7597 | * 6ch mode |
| 7598 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7599 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7600 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7601 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7602 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7603 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7604 | { } /* end */ |
| 7605 | }; |
| 7606 | |
| 7607 | /* |
| 7608 | * 8ch mode |
| 7609 | */ |
| 7610 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7611 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7612 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7613 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7614 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7615 | { } /* end */ |
| 7616 | }; |
| 7617 | |
| 7618 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7619 | { 6, alc883_sixstack_ch6_init }, |
| 7620 | { 8, alc883_sixstack_ch8_init }, |
| 7621 | }; |
| 7622 | |
| 7623 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7624 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7625 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7626 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7627 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7628 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7629 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7630 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7631 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7632 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7633 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7634 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7635 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7636 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7637 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7638 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7639 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7640 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7641 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7642 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7643 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7644 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7645 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7646 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7647 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7648 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7649 | { } /* end */ |
| 7650 | }; |
| 7651 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7652 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 7653 | |
| 7654 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 7655 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7656 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 7657 | { } |
| 7658 | }; |
| 7659 | |
| 7660 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7661 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7662 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7663 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7664 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7665 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7666 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7667 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7668 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7669 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7670 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7671 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7672 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7673 | { } /* end */ |
| 7674 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7675 | |
| 7676 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7677 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7678 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7679 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7680 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7681 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7682 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7683 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7684 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7685 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7686 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7687 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7688 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7689 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7690 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7691 | { } /* end */ |
| 7692 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7693 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7694 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 7695 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7696 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7697 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7698 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7699 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7700 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7701 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7702 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 7703 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7704 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 7705 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7706 | { } /* end */ |
| 7707 | }; |
| 7708 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7709 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7710 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7711 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7712 | { } /* end */ |
| 7713 | }; |
| 7714 | |
| 7715 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7716 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7717 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7718 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7719 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7720 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7721 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7722 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7723 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7724 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7725 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7726 | { } /* end */ |
| 7727 | }; |
| 7728 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7729 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7730 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7731 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7732 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7733 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7734 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7735 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7736 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7737 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7738 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7739 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7740 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7741 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7742 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7743 | { } /* end */ |
| 7744 | }; |
| 7745 | |
| 7746 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7747 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7748 | */ |
| 7749 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7750 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7751 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7752 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7753 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7754 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7755 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7756 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7757 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7758 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7759 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7760 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7761 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7762 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7763 | { } /* end */ |
| 7764 | }; |
| 7765 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7766 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7767 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7768 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7769 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7770 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7771 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7772 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7773 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7774 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7775 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7776 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7777 | { } /* end */ |
| 7778 | }; |
| 7779 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7780 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7781 | { |
| 7782 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7783 | .name = "Channel Mode", |
| 7784 | .info = alc_ch_mode_info, |
| 7785 | .get = alc_ch_mode_get, |
| 7786 | .put = alc_ch_mode_put, |
| 7787 | }, |
| 7788 | { } /* end */ |
| 7789 | }; |
| 7790 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7791 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7792 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7793 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7794 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7795 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7796 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7797 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7798 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7799 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7800 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7801 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7802 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7803 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7804 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7805 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7806 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7807 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7808 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7809 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7810 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7811 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7812 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7813 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7814 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7815 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7816 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7817 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7818 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7819 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7820 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7821 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7822 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7823 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7824 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7825 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7826 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7827 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7828 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7829 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7830 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7831 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7832 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7833 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7834 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7835 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7836 | |
| 7837 | /* FIXME: use matrix-type input source selection */ |
| 7838 | /* 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] | 7839 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7840 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7841 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7842 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7843 | /* ADC2: mute amp left and right */ |
| 7844 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7845 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7846 | /* ADC3: mute amp left and right */ |
| 7847 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7848 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7849 | |
| 7850 | { } |
| 7851 | }; |
| 7852 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7853 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7854 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7855 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7856 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7857 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7858 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7859 | /* ADC1: mute amp left and right */ |
| 7860 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7861 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7862 | { } |
| 7863 | }; |
| 7864 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7865 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7866 | /* change to EAPD mode */ |
| 7867 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7868 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7869 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7870 | }; |
| 7871 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7872 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7873 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7874 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7875 | { } |
| 7876 | }; |
| 7877 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7878 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7879 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7880 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7881 | {} |
| 7882 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7883 | |
| 7884 | static struct hda_verb alc885_init_verbs[] = { |
| 7885 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7886 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7887 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7888 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7889 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7890 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7891 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7892 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7893 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7894 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7895 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7896 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7897 | |
| 7898 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7899 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7900 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7901 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7902 | /* Front Pin: output 0 (0x0c) */ |
| 7903 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7904 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7905 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7906 | /* Rear Pin: output 1 (0x0d) */ |
| 7907 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7908 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7909 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7910 | /* CLFE Pin: output 2 (0x0e) */ |
| 7911 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7912 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7913 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7914 | /* Side Pin: output 3 (0x0f) */ |
| 7915 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7916 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7917 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7918 | /* Mic (rear) pin: input vref at 80% */ |
| 7919 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7920 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7921 | /* Front Mic pin: input vref at 80% */ |
| 7922 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7923 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7924 | /* Line In pin: input */ |
| 7925 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7926 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7927 | |
| 7928 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7929 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7930 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7931 | /* Input mixer2 */ |
| 7932 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7933 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7934 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7935 | /* ADC2: mute amp left and right */ |
| 7936 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7937 | /* ADC3: mute amp left and right */ |
| 7938 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7939 | |
| 7940 | { } |
| 7941 | }; |
| 7942 | |
| 7943 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7944 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7945 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7946 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7947 | { } |
| 7948 | }; |
| 7949 | |
| 7950 | |
| 7951 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7952 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7953 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7954 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7955 | { } |
| 7956 | }; |
| 7957 | |
| 7958 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7959 | #define alc883_init_verbs alc882_base_init_verbs |
| 7960 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7961 | /* Mac Pro test */ |
| 7962 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7963 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7964 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7965 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7966 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7967 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7968 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 7969 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7970 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7971 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7972 | { } /* end */ |
| 7973 | }; |
| 7974 | |
| 7975 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7976 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7977 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7978 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7979 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7980 | /* Front Pin: output 0 (0x0c) */ |
| 7981 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7982 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7983 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7984 | /* Front Mic pin: input vref at 80% */ |
| 7985 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7986 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7987 | /* Speaker: output */ |
| 7988 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7989 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7990 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7991 | /* Headphone output (output 0 - 0x0c) */ |
| 7992 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7993 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7994 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7995 | |
| 7996 | /* FIXME: use matrix-type input source selection */ |
| 7997 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7998 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7999 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8000 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8001 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8002 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8003 | /* Input mixer2 */ |
| 8004 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8005 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8006 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8007 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8008 | /* Input mixer3 */ |
| 8009 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8010 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8011 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8012 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8013 | /* ADC1: mute amp left and right */ |
| 8014 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8015 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8016 | /* ADC2: mute amp left and right */ |
| 8017 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8018 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8019 | /* ADC3: mute amp left and right */ |
| 8020 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8021 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8022 | |
| 8023 | { } |
| 8024 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8025 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8026 | /* Macbook 5,1 */ |
| 8027 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8028 | /* DACs */ |
| 8029 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8030 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8031 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8032 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8033 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8034 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8035 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8036 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8037 | /* Surround mixer */ |
| 8038 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8039 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8040 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8041 | /* LFE mixer */ |
| 8042 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8043 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8044 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8045 | /* HP mixer */ |
| 8046 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8047 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8048 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8049 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8050 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8051 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8052 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8053 | /* LFE Pin (0x0e) */ |
| 8054 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8055 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8056 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8057 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8058 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8059 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8060 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8061 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8062 | /* Front Mic pin: input vref at 80% */ |
| 8063 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8064 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8065 | /* Line In pin */ |
| 8066 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8067 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8068 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8069 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8070 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8071 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8072 | { } |
| 8073 | }; |
| 8074 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8075 | /* Macmini 3,1 */ |
| 8076 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 8077 | /* DACs */ |
| 8078 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8079 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8080 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8081 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8082 | /* Front mixer */ |
| 8083 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8084 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8085 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8086 | /* Surround mixer */ |
| 8087 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8088 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8089 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8090 | /* LFE mixer */ |
| 8091 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8092 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8093 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8094 | /* HP mixer */ |
| 8095 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8096 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8097 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8098 | /* Front Pin (0x0c) */ |
| 8099 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8100 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8101 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8102 | /* LFE Pin (0x0e) */ |
| 8103 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8104 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8105 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8106 | /* HP Pin (0x0f) */ |
| 8107 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8108 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8109 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8110 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8111 | /* Line In pin */ |
| 8112 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8113 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8114 | |
| 8115 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8116 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8117 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8118 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8119 | { } |
| 8120 | }; |
| 8121 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8122 | |
| 8123 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8124 | /*Internal and HP Speaker Mixer*/ |
| 8125 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8126 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8127 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8128 | /*Internal Speaker Pin (0x0c)*/ |
| 8129 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8130 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8131 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8132 | /* HP Pin: output 0 (0x0e) */ |
| 8133 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8134 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8135 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8136 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8137 | /* Line in (is hp when jack connected)*/ |
| 8138 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8139 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8140 | |
| 8141 | { } |
| 8142 | }; |
| 8143 | |
| 8144 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8145 | /* Macbook Pro rev3 */ |
| 8146 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8147 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8148 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8149 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8150 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8151 | /* Rear mixer */ |
| 8152 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8153 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8154 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8155 | /* HP mixer */ |
| 8156 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8157 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8158 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8159 | /* Front Pin: output 0 (0x0c) */ |
| 8160 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8161 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8162 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8163 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8164 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8165 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8166 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8167 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8168 | /* Mic (rear) pin: input vref at 80% */ |
| 8169 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8170 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8171 | /* Front Mic pin: input vref at 80% */ |
| 8172 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8173 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8174 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8175 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8176 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8177 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8178 | |
| 8179 | /* FIXME: use matrix-type input source selection */ |
| 8180 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8181 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8182 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8183 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8184 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8185 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8186 | /* Input mixer2 */ |
| 8187 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8188 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8189 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8190 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8191 | /* Input mixer3 */ |
| 8192 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8193 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8194 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8195 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8196 | /* ADC1: mute amp left and right */ |
| 8197 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8198 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8199 | /* ADC2: mute amp left and right */ |
| 8200 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8201 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8202 | /* ADC3: mute amp left and right */ |
| 8203 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8204 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8205 | |
| 8206 | { } |
| 8207 | }; |
| 8208 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8209 | /* iMac 9,1 */ |
| 8210 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8211 | /* Internal Speaker Pin (0x0c) */ |
| 8212 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8213 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8214 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8215 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8216 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8217 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8218 | /* HP Pin: Rear */ |
| 8219 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8220 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8221 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8222 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8223 | /* Line in Rear */ |
| 8224 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8225 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8226 | /* Front Mic pin: input vref at 80% */ |
| 8227 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8228 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8229 | /* Rear mixer */ |
| 8230 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8231 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8232 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8233 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8234 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8235 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8236 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8237 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8238 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8239 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8240 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8241 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8242 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8243 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8244 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8245 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8246 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8247 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8248 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8249 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8250 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8251 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8252 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8253 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8254 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8255 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8256 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8257 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8258 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8259 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8260 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8261 | { } |
| 8262 | }; |
| 8263 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8264 | /* iMac 24 mixer. */ |
| 8265 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8266 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8267 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8268 | { } /* end */ |
| 8269 | }; |
| 8270 | |
| 8271 | /* iMac 24 init verbs. */ |
| 8272 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8273 | /* Internal speakers: output 0 (0x0c) */ |
| 8274 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8275 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8276 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8277 | /* Internal speakers: output 0 (0x0c) */ |
| 8278 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8279 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8280 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8281 | /* Headphone: output 0 (0x0c) */ |
| 8282 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8283 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8284 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8285 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8286 | /* Front Mic: input vref at 80% */ |
| 8287 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8288 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8289 | { } |
| 8290 | }; |
| 8291 | |
| 8292 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8293 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8294 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8295 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8296 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8297 | spec->autocfg.hp_pins[0] = 0x14; |
| 8298 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8299 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8300 | } |
| 8301 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8302 | #define alc885_mb5_setup alc885_imac24_setup |
| 8303 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8304 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8305 | /* Macbook Air 2,1 */ |
| 8306 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8307 | { |
| 8308 | struct alc_spec *spec = codec->spec; |
| 8309 | |
| 8310 | spec->autocfg.hp_pins[0] = 0x14; |
| 8311 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8312 | } |
| 8313 | |
| 8314 | |
| 8315 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8316 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8317 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8318 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8319 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8320 | spec->autocfg.hp_pins[0] = 0x15; |
| 8321 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8322 | } |
| 8323 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8324 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8325 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8326 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8327 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8328 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8329 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8330 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8331 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8332 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8333 | static struct hda_verb alc882_targa_verbs[] = { |
| 8334 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8335 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8336 | |
| 8337 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8338 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8339 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8340 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8341 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8342 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8343 | |
| 8344 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8345 | { } /* end */ |
| 8346 | }; |
| 8347 | |
| 8348 | /* toggle speaker-output according to the hp-jack state */ |
| 8349 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8350 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8351 | struct alc_spec *spec = codec->spec; |
| 8352 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8353 | 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] | 8354 | spec->jack_present ? 1 : 3); |
| 8355 | } |
| 8356 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8357 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8358 | { |
| 8359 | struct alc_spec *spec = codec->spec; |
| 8360 | |
| 8361 | spec->autocfg.hp_pins[0] = 0x14; |
| 8362 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8363 | } |
| 8364 | |
| 8365 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8366 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8367 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8368 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8369 | } |
| 8370 | |
| 8371 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8372 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8373 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8374 | |
| 8375 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8376 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8377 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8378 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8379 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8380 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8381 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8382 | |
| 8383 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8384 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8385 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8386 | { } /* end */ |
| 8387 | }; |
| 8388 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8389 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8390 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8391 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8392 | |
| 8393 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8394 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8395 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8396 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8397 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8398 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8399 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8400 | |
| 8401 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8402 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8403 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8404 | { } /* end */ |
| 8405 | }; |
| 8406 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8407 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8408 | { |
| 8409 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8410 | |
| 8411 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8412 | AC_VERB_GET_GPIO_DATA, 0); |
| 8413 | |
| 8414 | if (!muted) |
| 8415 | gpiostate |= (1 << pin); |
| 8416 | else |
| 8417 | gpiostate &= ~(1 << pin); |
| 8418 | |
| 8419 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8420 | AC_VERB_GET_GPIO_MASK, 0); |
| 8421 | gpiomask |= (1 << pin); |
| 8422 | |
| 8423 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8424 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8425 | gpiodir |= (1 << pin); |
| 8426 | |
| 8427 | |
| 8428 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8429 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8430 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8431 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8432 | |
| 8433 | msleep(1); |
| 8434 | |
| 8435 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8436 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8437 | } |
| 8438 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8439 | /* set up GPIO at initialization */ |
| 8440 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8441 | { |
| 8442 | alc882_gpio_mute(codec, 0, 0); |
| 8443 | alc882_gpio_mute(codec, 1, 0); |
| 8444 | } |
| 8445 | |
| 8446 | /* set up GPIO and update auto-muting at initialization */ |
| 8447 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8448 | { |
| 8449 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8450 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8451 | } |
| 8452 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8453 | /* |
| 8454 | * generic initialization of ADC, input mixers and output mixers |
| 8455 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8456 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8457 | /* |
| 8458 | * Unmute ADC0-2 and set the default input to mic-in |
| 8459 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8460 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8461 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8462 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8463 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8464 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8465 | /* |
| 8466 | * Set up output mixers (0x0c - 0x0f) |
| 8467 | */ |
| 8468 | /* set vol=0 to output mixers */ |
| 8469 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8470 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8471 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8472 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8473 | /* set up input amps for analog loopback */ |
| 8474 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8475 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8476 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8477 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8478 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8479 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8480 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8481 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8482 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8483 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8484 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8485 | |
| 8486 | /* FIXME: use matrix-type input source selection */ |
| 8487 | /* 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] | 8488 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8489 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8490 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8491 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8492 | { } |
| 8493 | }; |
| 8494 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8495 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8496 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8497 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8498 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8499 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8500 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8501 | { } /* end */ |
| 8502 | }; |
| 8503 | |
| 8504 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8505 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8506 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8507 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8508 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8509 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8510 | { } /* end */ |
| 8511 | }; |
| 8512 | |
| 8513 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8514 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8515 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8516 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8517 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8518 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8519 | { } /* end */ |
| 8520 | }; |
| 8521 | |
| 8522 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8523 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8524 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8525 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8526 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8527 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8528 | { } /* end */ |
| 8529 | }; |
| 8530 | |
| 8531 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8532 | { 2, alc889A_mb31_ch2_init }, |
| 8533 | { 4, alc889A_mb31_ch4_init }, |
| 8534 | { 5, alc889A_mb31_ch5_init }, |
| 8535 | { 6, alc889A_mb31_ch6_init }, |
| 8536 | }; |
| 8537 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8538 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8539 | /* eanable EAPD on medion laptop */ |
| 8540 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8541 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8542 | { } |
| 8543 | }; |
| 8544 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8545 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8546 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8547 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8548 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8549 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8550 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8551 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8552 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8553 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8554 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8555 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8556 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8557 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8558 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8559 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8560 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8561 | { } /* end */ |
| 8562 | }; |
| 8563 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8564 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8565 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8566 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8567 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8568 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8569 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8570 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8571 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8572 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8573 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8574 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8575 | { } /* end */ |
| 8576 | }; |
| 8577 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8578 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8579 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8580 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8581 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8582 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8583 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8584 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8585 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8586 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8587 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8588 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8589 | { } /* end */ |
| 8590 | }; |
| 8591 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8592 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8593 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8594 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8595 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8596 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8597 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8598 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8599 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8600 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8601 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8602 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8603 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8604 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8605 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8606 | { } /* end */ |
| 8607 | }; |
| 8608 | |
| 8609 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8610 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8611 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8612 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8613 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8614 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8615 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8616 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8617 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8618 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8619 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8620 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8621 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8622 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8623 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8624 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8625 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8626 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8627 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8628 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8629 | { } /* end */ |
| 8630 | }; |
| 8631 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8632 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8633 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8634 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8635 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8636 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8637 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8638 | HDA_OUTPUT), |
| 8639 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8640 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8641 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8642 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8643 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8644 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8645 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8646 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8647 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8648 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8649 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8650 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8651 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8652 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8653 | { } /* end */ |
| 8654 | }; |
| 8655 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8656 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8657 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8658 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8659 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8660 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8661 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8662 | HDA_OUTPUT), |
| 8663 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8664 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8665 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8666 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8667 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8668 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8669 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8670 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8671 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 8672 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 8673 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8674 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8675 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8676 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8677 | { } /* end */ |
| 8678 | }; |
| 8679 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8680 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8681 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8682 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8683 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8684 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8685 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8686 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8687 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8688 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8689 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8690 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8691 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8692 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8693 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8694 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8695 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8696 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8697 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8698 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8699 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8700 | { } /* end */ |
| 8701 | }; |
| 8702 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8703 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8704 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8705 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8706 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8707 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8708 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8709 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8710 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8711 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8712 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8713 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8714 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8715 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8716 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8717 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8718 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8719 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8720 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8721 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8722 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8723 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8724 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8725 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8726 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8727 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8728 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8729 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8730 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8731 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8732 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8733 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8734 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8735 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8736 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8737 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8738 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8739 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8740 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 8741 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8742 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8743 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8744 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8745 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8746 | { } /* end */ |
| 8747 | }; |
| 8748 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8749 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8750 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8751 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8752 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8753 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8754 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8755 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8756 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8757 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8758 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8759 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8760 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8761 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8762 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8763 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8764 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8765 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8766 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8767 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8768 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 150b432 | 2010-07-29 14:46:42 +0200 | [diff] [blame] | 8769 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8770 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8771 | { } /* end */ |
| 8772 | }; |
| 8773 | |
| 8774 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8775 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8776 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8777 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8778 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8779 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8780 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8781 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8782 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8783 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8784 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8785 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8786 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 8787 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 8788 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8789 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8790 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8791 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 8792 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 8793 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 8794 | { } /* end */ |
| 8795 | }; |
| 8796 | |
| 8797 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 8798 | /* Unmute front mixer */ |
| 8799 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8800 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8801 | |
| 8802 | /* Set speaker pin to front mixer */ |
| 8803 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8804 | |
| 8805 | /* Init headphone pin */ |
| 8806 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8807 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8808 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8809 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8810 | |
| 8811 | { } /* end */ |
| 8812 | }; |
| 8813 | |
| 8814 | /* toggle speaker-output according to the hp-jack state */ |
| 8815 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 8816 | { |
| 8817 | struct alc_spec *spec = codec->spec; |
| 8818 | |
| 8819 | spec->autocfg.hp_pins[0] = 0x1a; |
| 8820 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8821 | } |
| 8822 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8823 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8824 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8825 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8826 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8827 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8828 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8829 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8830 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8831 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8832 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8833 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8834 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8835 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8836 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8837 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 8838 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8839 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8840 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8841 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8842 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8843 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8844 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8845 | { } /* end */ |
| 8846 | }; |
| 8847 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8848 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8849 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8850 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8851 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8852 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8853 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8854 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8855 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8856 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8857 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8858 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8859 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8860 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8861 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8862 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8863 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8864 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8865 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8866 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8867 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8868 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8869 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8870 | { } /* end */ |
| 8871 | }; |
| 8872 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8873 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8874 | /* Output mixers */ |
| 8875 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8876 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8877 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8878 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8879 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8880 | HDA_OUTPUT), |
| 8881 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8882 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8883 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8884 | /* Output switches */ |
| 8885 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8886 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8887 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8888 | /* Boost mixers */ |
| 8889 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8890 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8891 | /* Input mixers */ |
| 8892 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8893 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8894 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8895 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8896 | { } /* end */ |
| 8897 | }; |
| 8898 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8899 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8900 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8901 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8902 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8903 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8904 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8905 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8906 | { } /* end */ |
| 8907 | }; |
| 8908 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8909 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8910 | .ops = &snd_hda_bind_vol, |
| 8911 | .values = { |
| 8912 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8913 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8914 | 0 |
| 8915 | }, |
| 8916 | }; |
| 8917 | |
| 8918 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8919 | .ops = &snd_hda_bind_sw, |
| 8920 | .values = { |
| 8921 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8922 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8923 | 0 |
| 8924 | }, |
| 8925 | }; |
| 8926 | |
| 8927 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8928 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8929 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8930 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8931 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8932 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8933 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8934 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8935 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8936 | { } /* end */ |
| 8937 | }; |
| 8938 | |
| 8939 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8940 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8941 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8942 | { |
| 8943 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8944 | /* .name = "Capture Source", */ |
| 8945 | .name = "Input Source", |
| 8946 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8947 | .info = alc_mux_enum_info, |
| 8948 | .get = alc_mux_enum_get, |
| 8949 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8950 | }, |
| 8951 | { } /* end */ |
| 8952 | }; |
| 8953 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8954 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8955 | { |
| 8956 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8957 | .name = "Channel Mode", |
| 8958 | .info = alc_ch_mode_info, |
| 8959 | .get = alc_ch_mode_get, |
| 8960 | .put = alc_ch_mode_put, |
| 8961 | }, |
| 8962 | { } /* end */ |
| 8963 | }; |
| 8964 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8965 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8966 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8967 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8968 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8969 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8970 | spec->autocfg.hp_pins[0] = 0x15; |
| 8971 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8972 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8973 | } |
| 8974 | |
| 8975 | /* auto-toggle front mic */ |
| 8976 | /* |
| 8977 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8978 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8979 | unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8980 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8981 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8982 | } |
| 8983 | */ |
| 8984 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8985 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8986 | /* HP */ |
| 8987 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8988 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8989 | /* Subwoofer */ |
| 8990 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8991 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8992 | |
| 8993 | /* enable unsolicited event */ |
| 8994 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8995 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8996 | |
| 8997 | { } /* end */ |
| 8998 | }; |
| 8999 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9000 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 9001 | /* HP */ |
| 9002 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9003 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9004 | /* Int speaker */ |
| 9005 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 9006 | |
| 9007 | /* enable unsolicited event */ |
| 9008 | /* |
| 9009 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9010 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9011 | */ |
| 9012 | |
| 9013 | { } /* end */ |
| 9014 | }; |
| 9015 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9016 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9017 | /* HP */ |
| 9018 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9019 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9020 | /* Int speaker */ |
| 9021 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9022 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9023 | |
| 9024 | /* enable unsolicited event */ |
| 9025 | {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] | 9026 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9027 | |
| 9028 | { } /* end */ |
| 9029 | }; |
| 9030 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9031 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 9032 | /* HP */ |
| 9033 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9034 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9035 | /* Subwoofer */ |
| 9036 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9037 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9038 | |
| 9039 | /* enable unsolicited event */ |
| 9040 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9041 | |
| 9042 | { } /* end */ |
| 9043 | }; |
| 9044 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9045 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9046 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9047 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9048 | |
| 9049 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9050 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9051 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9052 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9053 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9054 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9055 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9056 | /* Connect Mic jack to CLFE */ |
| 9057 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9058 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9059 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9060 | /* Connect Line-in jack to Surround */ |
| 9061 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9062 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9063 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9064 | /* Connect HP out jack to Front */ |
| 9065 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9066 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9067 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9068 | |
| 9069 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9070 | |
| 9071 | { } /* end */ |
| 9072 | }; |
| 9073 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9074 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 9075 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9076 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9077 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9078 | { } /* end */ |
| 9079 | }; |
| 9080 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9081 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 9082 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9083 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9084 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9085 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9086 | { } /* end */ |
| 9087 | }; |
| 9088 | |
| 9089 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 9090 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9091 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9092 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9093 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9094 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9095 | { } /* end */ |
| 9096 | }; |
| 9097 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9098 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 9099 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9100 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9101 | |
| 9102 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9103 | |
| 9104 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9105 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9106 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9107 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9108 | { } /* end */ |
| 9109 | }; |
| 9110 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9111 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9112 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9113 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9114 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9115 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9116 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9117 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9118 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9119 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9120 | { } /* end */ |
| 9121 | }; |
| 9122 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9123 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9124 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9125 | { } |
| 9126 | }; |
| 9127 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9128 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9129 | /* HP */ |
| 9130 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9131 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9132 | |
| 9133 | /* enable unsolicited event */ |
| 9134 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9135 | |
| 9136 | { } /* end */ |
| 9137 | }; |
| 9138 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9139 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9140 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9141 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9142 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9143 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9144 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9145 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9146 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9147 | } |
| 9148 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9149 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9150 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9151 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9152 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9153 | {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] | 9154 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9155 | }; |
| 9156 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9157 | /* |
| 9158 | * 2ch mode |
| 9159 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9160 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9161 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9162 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9163 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9164 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9165 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9166 | }; |
| 9167 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9168 | /* |
| 9169 | * 4ch mode |
| 9170 | */ |
| 9171 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9172 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9173 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9174 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9175 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9176 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9177 | { } /* end */ |
| 9178 | }; |
| 9179 | |
| 9180 | /* |
| 9181 | * 6ch mode |
| 9182 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9183 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9184 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9185 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9186 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9187 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9188 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9189 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9190 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9191 | }; |
| 9192 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9193 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9194 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9195 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9196 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9197 | }; |
| 9198 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9199 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 9200 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 9201 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9202 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9203 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9204 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9205 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9206 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9207 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9208 | } |
| 9209 | |
| 9210 | /* toggle RCA according to the front-jack state */ |
| 9211 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 9212 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9213 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9214 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9215 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9216 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9217 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9218 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9219 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 9220 | unsigned int res) |
| 9221 | { |
| 9222 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9223 | alc888_lenovo_ms7195_front_automute(codec); |
| 9224 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9225 | alc888_lenovo_ms7195_rca_automute(codec); |
| 9226 | } |
| 9227 | |
| 9228 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 9229 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9230 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9231 | |
| 9232 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9233 | |
| 9234 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9235 | { } /* end */ |
| 9236 | }; |
| 9237 | |
| 9238 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9239 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9240 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9241 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9242 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9243 | spec->autocfg.hp_pins[0] = 0x14; |
| 9244 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9245 | } |
| 9246 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9247 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9248 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9249 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9250 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9251 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 9252 | { |
| 9253 | unsigned int present; |
| 9254 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 9255 | present = snd_hda_jack_detect(codec, 0x18); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9256 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 9257 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9258 | } |
| 9259 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9260 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9261 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9262 | struct alc_spec *spec = codec->spec; |
| 9263 | |
| 9264 | spec->autocfg.hp_pins[0] = 0x15; |
| 9265 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9266 | } |
| 9267 | |
| 9268 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9269 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9270 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9271 | alc883_clevo_m720_mic_automute(codec); |
| 9272 | } |
| 9273 | |
| 9274 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9275 | unsigned int res) |
| 9276 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9277 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9278 | case ALC880_MIC_EVENT: |
| 9279 | alc883_clevo_m720_mic_automute(codec); |
| 9280 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9281 | default: |
| 9282 | alc_automute_amp_unsol_event(codec, res); |
| 9283 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9284 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9285 | } |
| 9286 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9287 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9288 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9289 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9290 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9291 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9292 | spec->autocfg.hp_pins[0] = 0x14; |
| 9293 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9294 | } |
| 9295 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9296 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9297 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9298 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9299 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9300 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9301 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9302 | } |
| 9303 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9304 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9305 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9306 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9307 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9308 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9309 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9310 | } |
| 9311 | |
| 9312 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9313 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9314 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9315 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9316 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9317 | HDA_AMP_MUTE, bits); |
| 9318 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9319 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9320 | } |
| 9321 | |
| 9322 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9323 | unsigned int res) |
| 9324 | { |
| 9325 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9326 | alc883_lenovo_101e_all_automute(codec); |
| 9327 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9328 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9329 | } |
| 9330 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9331 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9332 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9333 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9334 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9335 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9336 | spec->autocfg.hp_pins[0] = 0x14; |
| 9337 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9338 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9339 | } |
| 9340 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9341 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9342 | /* HP Pin: output 0 (0x0c) */ |
| 9343 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9344 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9345 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9346 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9347 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9348 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9349 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9350 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9351 | /* eanable EAPD on medion laptop */ |
| 9352 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9353 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9354 | /* enable unsolicited event */ |
| 9355 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9356 | { } |
| 9357 | }; |
| 9358 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9359 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 9360 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9361 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9362 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9363 | { } /* end */ |
| 9364 | }; |
| 9365 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9366 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9367 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9368 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9369 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9370 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9371 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9372 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9373 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9374 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9375 | } |
| 9376 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9377 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9378 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9379 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9380 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9381 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9382 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9383 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9384 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9385 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9386 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9387 | } |
| 9388 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9389 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9390 | { |
| 9391 | struct alc_spec *spec = codec->spec; |
| 9392 | |
| 9393 | spec->autocfg.hp_pins[0] = 0x15; |
| 9394 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9395 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9396 | } |
| 9397 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9398 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9399 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9400 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9401 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9402 | /* enable unsolicited event */ |
| 9403 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9404 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9405 | { } /* end */ |
| 9406 | }; |
| 9407 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9408 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9409 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9410 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9411 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9412 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9413 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9414 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9415 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9416 | spec->ext_mic.pin = 0x18; |
| 9417 | spec->int_mic.pin = 0x19; |
| 9418 | spec->ext_mic.mux_idx = 0; |
| 9419 | spec->int_mic.mux_idx = 1; |
| 9420 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9421 | } |
| 9422 | |
| 9423 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9424 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9425 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9426 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9427 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9428 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9429 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9430 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9431 | /* enable unsolicited event */ |
| 9432 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9433 | { } /* end */ |
| 9434 | }; |
| 9435 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9436 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9437 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9438 | struct alc_spec *spec = codec->spec; |
| 9439 | |
| 9440 | spec->autocfg.hp_pins[0] = 0x14; |
| 9441 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9442 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9443 | } |
| 9444 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9445 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9446 | /* Init rear pin (used as headphone output) */ |
| 9447 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9448 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9449 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9450 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9451 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9452 | /* Init line 2 pin (used as headphone out by default) */ |
| 9453 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9454 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9455 | { } /* end */ |
| 9456 | }; |
| 9457 | |
| 9458 | /* Mute speakers according to the headphone jack state */ |
| 9459 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9460 | { |
| 9461 | unsigned int present; |
| 9462 | |
| 9463 | /* Mute only in 2ch or 4ch mode */ |
| 9464 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9465 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9466 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9467 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9468 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9469 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9470 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9471 | } |
| 9472 | } |
| 9473 | |
| 9474 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9475 | { |
| 9476 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9477 | alc889A_mb31_automute(codec); |
| 9478 | } |
| 9479 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9480 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9481 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9482 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9483 | #endif |
| 9484 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9485 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9486 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9487 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9488 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9489 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9490 | |
| 9491 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9492 | ALC1200_DIGOUT_NID, 0, |
| 9493 | }; |
| 9494 | |
| 9495 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9496 | ALC883_DIGOUT_NID, 0, |
| 9497 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9498 | |
| 9499 | /* |
| 9500 | * configuration and preset |
| 9501 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9502 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 9503 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9504 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9505 | [ALC882_ARIMA] = "arima", |
| 9506 | [ALC882_W2JC] = "w2jc", |
| 9507 | [ALC882_TARGA] = "targa", |
| 9508 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9509 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9510 | [ALC885_MACPRO] = "macpro", |
| 9511 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9512 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9513 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9514 | [ALC885_MBP3] = "mbp3", |
| 9515 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9516 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9517 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9518 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9519 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9520 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9521 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9522 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9523 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9524 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9525 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9526 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9527 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9528 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9529 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9530 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9531 | [ALC883_MEDION_MD2] = "medion-md2", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9532 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9533 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9534 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9535 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9536 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9537 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9538 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9539 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9540 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9541 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9542 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9543 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9544 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9545 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9546 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9547 | [ALC889A_INTEL] = "intel-alc889a", |
| 9548 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9549 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9550 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9551 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9552 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9553 | }; |
| 9554 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9555 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9556 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9557 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9558 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9559 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9560 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9561 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9562 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9563 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9564 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9565 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9566 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9567 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9568 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9569 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9570 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9571 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9572 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9573 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9574 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9575 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9576 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9577 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9578 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9579 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9580 | /* default Acer -- disabled as it causes more problems. |
| 9581 | * model=auto should work fine now |
| 9582 | */ |
| 9583 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9584 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9585 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9586 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9587 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9588 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9589 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9590 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9591 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9592 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9593 | |
| 9594 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9595 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9596 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9597 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9598 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9599 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9600 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9601 | 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] | 9602 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9603 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9604 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9605 | |
| 9606 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9607 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9608 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9609 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9610 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9611 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9612 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9613 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9614 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9615 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9616 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9617 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9618 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9619 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9620 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9621 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9622 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9623 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9624 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9625 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9626 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9627 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9628 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9629 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9630 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9631 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9632 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9633 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9634 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9635 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9636 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9637 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9638 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9639 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9640 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9641 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9642 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9643 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9644 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9645 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9646 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9647 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9648 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9649 | 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] | 9650 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9651 | 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] | 9652 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9653 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9654 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9655 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9656 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9657 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9658 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9659 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9660 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9661 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9662 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9663 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9664 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9665 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9666 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9667 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9668 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9669 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9670 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9671 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9672 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9673 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9674 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9675 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9676 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9677 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9678 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9679 | {} |
| 9680 | }; |
| 9681 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9682 | /* codec SSID table for Intel Mac */ |
| 9683 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9684 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9685 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9686 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9687 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9688 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9689 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9690 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 9691 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 9692 | 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] | 9693 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 9694 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9695 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9696 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9697 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9698 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9699 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 9700 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9701 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9702 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9703 | */ |
| 9704 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9705 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9706 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9707 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9708 | }; |
| 9709 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9710 | static struct alc_config_preset alc882_presets[] = { |
| 9711 | [ALC882_3ST_DIG] = { |
| 9712 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9713 | .init_verbs = { alc882_base_init_verbs, |
| 9714 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9715 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9716 | .dac_nids = alc882_dac_nids, |
| 9717 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9718 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9719 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9720 | .channel_mode = alc882_ch_modes, |
| 9721 | .need_dac_fix = 1, |
| 9722 | .input_mux = &alc882_capture_source, |
| 9723 | }, |
| 9724 | [ALC882_6ST_DIG] = { |
| 9725 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9726 | .init_verbs = { alc882_base_init_verbs, |
| 9727 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9728 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9729 | .dac_nids = alc882_dac_nids, |
| 9730 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9731 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9732 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9733 | .channel_mode = alc882_sixstack_modes, |
| 9734 | .input_mux = &alc882_capture_source, |
| 9735 | }, |
| 9736 | [ALC882_ARIMA] = { |
| 9737 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9738 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9739 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9740 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9741 | .dac_nids = alc882_dac_nids, |
| 9742 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9743 | .channel_mode = alc882_sixstack_modes, |
| 9744 | .input_mux = &alc882_capture_source, |
| 9745 | }, |
| 9746 | [ALC882_W2JC] = { |
| 9747 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9748 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9749 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9750 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9751 | .dac_nids = alc882_dac_nids, |
| 9752 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9753 | .channel_mode = alc880_threestack_modes, |
| 9754 | .need_dac_fix = 1, |
| 9755 | .input_mux = &alc882_capture_source, |
| 9756 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9757 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9758 | [ALC885_MBA21] = { |
| 9759 | .mixers = { alc885_mba21_mixer }, |
| 9760 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 9761 | .num_dacs = 2, |
| 9762 | .dac_nids = alc882_dac_nids, |
| 9763 | .channel_mode = alc885_mba21_ch_modes, |
| 9764 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9765 | .input_mux = &alc882_capture_source, |
| 9766 | .unsol_event = alc_automute_amp_unsol_event, |
| 9767 | .setup = alc885_mba21_setup, |
| 9768 | .init_hook = alc_automute_amp, |
| 9769 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9770 | [ALC885_MBP3] = { |
| 9771 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 9772 | .init_verbs = { alc885_mbp3_init_verbs, |
| 9773 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9774 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9775 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9776 | .hp_nid = 0x04, |
| 9777 | .channel_mode = alc885_mbp_4ch_modes, |
| 9778 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9779 | .input_mux = &alc882_capture_source, |
| 9780 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9781 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9782 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9783 | .setup = alc885_mbp3_setup, |
| 9784 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9785 | }, |
| 9786 | [ALC885_MB5] = { |
| 9787 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 9788 | .init_verbs = { alc885_mb5_init_verbs, |
| 9789 | alc880_gpio1_init_verbs }, |
| 9790 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9791 | .dac_nids = alc882_dac_nids, |
| 9792 | .channel_mode = alc885_mb5_6ch_modes, |
| 9793 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 9794 | .input_mux = &mb5_capture_source, |
| 9795 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9796 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9797 | .unsol_event = alc_automute_amp_unsol_event, |
| 9798 | .setup = alc885_mb5_setup, |
| 9799 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9800 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9801 | [ALC885_MACMINI3] = { |
| 9802 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 9803 | .init_verbs = { alc885_macmini3_init_verbs, |
| 9804 | alc880_gpio1_init_verbs }, |
| 9805 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9806 | .dac_nids = alc882_dac_nids, |
| 9807 | .channel_mode = alc885_macmini3_6ch_modes, |
| 9808 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 9809 | .input_mux = &macmini3_capture_source, |
| 9810 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9811 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9812 | .unsol_event = alc_automute_amp_unsol_event, |
| 9813 | .setup = alc885_macmini3_setup, |
| 9814 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9815 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9816 | [ALC885_MACPRO] = { |
| 9817 | .mixers = { alc882_macpro_mixer }, |
| 9818 | .init_verbs = { alc882_macpro_init_verbs }, |
| 9819 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9820 | .dac_nids = alc882_dac_nids, |
| 9821 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9822 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9823 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9824 | .channel_mode = alc882_ch_modes, |
| 9825 | .input_mux = &alc882_capture_source, |
| 9826 | .init_hook = alc885_macpro_init_hook, |
| 9827 | }, |
| 9828 | [ALC885_IMAC24] = { |
| 9829 | .mixers = { alc885_imac24_mixer }, |
| 9830 | .init_verbs = { alc885_imac24_init_verbs }, |
| 9831 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9832 | .dac_nids = alc882_dac_nids, |
| 9833 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9834 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9835 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9836 | .channel_mode = alc882_ch_modes, |
| 9837 | .input_mux = &alc882_capture_source, |
| 9838 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9839 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9840 | .init_hook = alc885_imac24_init_hook, |
| 9841 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9842 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 9843 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9844 | .init_verbs = { alc885_imac91_init_verbs, |
| 9845 | alc880_gpio1_init_verbs }, |
| 9846 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9847 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 9848 | .channel_mode = alc885_mba21_ch_modes, |
| 9849 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9850 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9851 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9852 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9853 | .unsol_event = alc_automute_amp_unsol_event, |
| 9854 | .setup = alc885_imac91_setup, |
| 9855 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9856 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9857 | [ALC882_TARGA] = { |
| 9858 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9859 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 9860 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9861 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9862 | .dac_nids = alc882_dac_nids, |
| 9863 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9864 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9865 | .adc_nids = alc882_adc_nids, |
| 9866 | .capsrc_nids = alc882_capsrc_nids, |
| 9867 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9868 | .channel_mode = alc882_3ST_6ch_modes, |
| 9869 | .need_dac_fix = 1, |
| 9870 | .input_mux = &alc882_capture_source, |
| 9871 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9872 | .setup = alc882_targa_setup, |
| 9873 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9874 | }, |
| 9875 | [ALC882_ASUS_A7J] = { |
| 9876 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9877 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9878 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9879 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9880 | .dac_nids = alc882_dac_nids, |
| 9881 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9882 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9883 | .adc_nids = alc882_adc_nids, |
| 9884 | .capsrc_nids = alc882_capsrc_nids, |
| 9885 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9886 | .channel_mode = alc882_3ST_6ch_modes, |
| 9887 | .need_dac_fix = 1, |
| 9888 | .input_mux = &alc882_capture_source, |
| 9889 | }, |
| 9890 | [ALC882_ASUS_A7M] = { |
| 9891 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9892 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9893 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9894 | alc882_asus_a7m_verbs }, |
| 9895 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9896 | .dac_nids = alc882_dac_nids, |
| 9897 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9898 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9899 | .channel_mode = alc880_threestack_modes, |
| 9900 | .need_dac_fix = 1, |
| 9901 | .input_mux = &alc882_capture_source, |
| 9902 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9903 | [ALC883_3ST_2ch_DIG] = { |
| 9904 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9905 | .init_verbs = { alc883_init_verbs }, |
| 9906 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9907 | .dac_nids = alc883_dac_nids, |
| 9908 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9909 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9910 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9911 | .channel_mode = alc883_3ST_2ch_modes, |
| 9912 | .input_mux = &alc883_capture_source, |
| 9913 | }, |
| 9914 | [ALC883_3ST_6ch_DIG] = { |
| 9915 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9916 | .init_verbs = { alc883_init_verbs }, |
| 9917 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9918 | .dac_nids = alc883_dac_nids, |
| 9919 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9920 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9921 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9922 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9923 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9924 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9925 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9926 | [ALC883_3ST_6ch] = { |
| 9927 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9928 | .init_verbs = { alc883_init_verbs }, |
| 9929 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9930 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9931 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9932 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9933 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9934 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9935 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9936 | [ALC883_3ST_6ch_INTEL] = { |
| 9937 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9938 | .init_verbs = { alc883_init_verbs }, |
| 9939 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9940 | .dac_nids = alc883_dac_nids, |
| 9941 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9942 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9943 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9944 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9945 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9946 | .need_dac_fix = 1, |
| 9947 | .input_mux = &alc883_3stack_6ch_intel, |
| 9948 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9949 | [ALC889A_INTEL] = { |
| 9950 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9951 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 9952 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9953 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9954 | .dac_nids = alc883_dac_nids, |
| 9955 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9956 | .adc_nids = alc889_adc_nids, |
| 9957 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9958 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9959 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9960 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9961 | .channel_mode = alc889_8ch_intel_modes, |
| 9962 | .capsrc_nids = alc889_capsrc_nids, |
| 9963 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9964 | .setup = alc889_automute_setup, |
| 9965 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9966 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9967 | .need_dac_fix = 1, |
| 9968 | }, |
| 9969 | [ALC889_INTEL] = { |
| 9970 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9971 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9972 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9973 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9974 | .dac_nids = alc883_dac_nids, |
| 9975 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9976 | .adc_nids = alc889_adc_nids, |
| 9977 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9978 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9979 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9980 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9981 | .channel_mode = alc889_8ch_intel_modes, |
| 9982 | .capsrc_nids = alc889_capsrc_nids, |
| 9983 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9984 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9985 | .init_hook = alc889_intel_init_hook, |
| 9986 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9987 | .need_dac_fix = 1, |
| 9988 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9989 | [ALC883_6ST_DIG] = { |
| 9990 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9991 | .init_verbs = { alc883_init_verbs }, |
| 9992 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9993 | .dac_nids = alc883_dac_nids, |
| 9994 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9995 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9996 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9997 | .channel_mode = alc883_sixstack_modes, |
| 9998 | .input_mux = &alc883_capture_source, |
| 9999 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10000 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10001 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10002 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10003 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10004 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10005 | .dac_nids = alc883_dac_nids, |
| 10006 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10007 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10008 | .channel_mode = alc883_3ST_6ch_modes, |
| 10009 | .need_dac_fix = 1, |
| 10010 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10011 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10012 | .setup = alc882_targa_setup, |
| 10013 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10014 | }, |
| 10015 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10016 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10017 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10018 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10019 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10020 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10021 | .adc_nids = alc883_adc_nids_alt, |
| 10022 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10023 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10024 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10025 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10026 | .channel_mode = alc883_3ST_2ch_modes, |
| 10027 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10028 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10029 | .setup = alc882_targa_setup, |
| 10030 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10031 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10032 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10033 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10034 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10035 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10036 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10037 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10038 | .dac_nids = alc883_dac_nids, |
| 10039 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10040 | .adc_nids = alc883_adc_nids_rev, |
| 10041 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10042 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10043 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10044 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10045 | .channel_mode = alc883_4ST_8ch_modes, |
| 10046 | .need_dac_fix = 1, |
| 10047 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10048 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10049 | .setup = alc882_targa_setup, |
| 10050 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10051 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10052 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10053 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10054 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10055 | * and the headphone jack. Turn this on and rely on the |
| 10056 | * standard mute methods whenever the user wants to turn |
| 10057 | * these outputs off. |
| 10058 | */ |
| 10059 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10060 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10061 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10062 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10063 | .channel_mode = alc883_3ST_2ch_modes, |
| 10064 | .input_mux = &alc883_capture_source, |
| 10065 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10066 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10067 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10068 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10069 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10070 | .dac_nids = alc883_dac_nids, |
| 10071 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10072 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10073 | .channel_mode = alc883_3ST_2ch_modes, |
| 10074 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10075 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10076 | .setup = alc883_acer_aspire_setup, |
| 10077 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10078 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10079 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10080 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10081 | alc883_chmode_mixer }, |
| 10082 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10083 | alc888_acer_aspire_4930g_verbs }, |
| 10084 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10085 | .dac_nids = alc883_dac_nids, |
| 10086 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10087 | .adc_nids = alc883_adc_nids_rev, |
| 10088 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10089 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10090 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10091 | .channel_mode = alc883_3ST_6ch_modes, |
| 10092 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10093 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10094 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10095 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10096 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10097 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10098 | .setup = alc888_acer_aspire_4930g_setup, |
| 10099 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10100 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10101 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10102 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10103 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10104 | alc888_acer_aspire_6530g_verbs }, |
| 10105 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10106 | .dac_nids = alc883_dac_nids, |
| 10107 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10108 | .adc_nids = alc883_adc_nids_rev, |
| 10109 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10110 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10111 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10112 | .channel_mode = alc883_3ST_2ch_modes, |
| 10113 | .num_mux_defs = |
| 10114 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10115 | .input_mux = alc888_acer_aspire_6530_sources, |
| 10116 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10117 | .setup = alc888_acer_aspire_6530g_setup, |
| 10118 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10119 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10120 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10121 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10122 | alc883_chmode_mixer }, |
| 10123 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10124 | alc889_acer_aspire_8930g_verbs, |
| 10125 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10126 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10127 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10128 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10129 | .adc_nids = alc889_adc_nids, |
| 10130 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10131 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10132 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10133 | .channel_mode = alc883_3ST_6ch_modes, |
| 10134 | .need_dac_fix = 1, |
| 10135 | .const_channel_count = 6, |
| 10136 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10137 | ARRAY_SIZE(alc889_capture_sources), |
| 10138 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10139 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10140 | .setup = alc889_acer_aspire_8930g_setup, |
| 10141 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10142 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10143 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10144 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10145 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10146 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10147 | .mixers = { alc883_3ST_6ch_mixer, |
| 10148 | alc883_chmode_mixer }, |
| 10149 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10150 | alc888_acer_aspire_7730G_verbs }, |
| 10151 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10152 | .dac_nids = alc883_dac_nids, |
| 10153 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10154 | .adc_nids = alc883_adc_nids_rev, |
| 10155 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10156 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10157 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10158 | .channel_mode = alc883_3ST_6ch_modes, |
| 10159 | .need_dac_fix = 1, |
| 10160 | .const_channel_count = 6, |
| 10161 | .input_mux = &alc883_capture_source, |
| 10162 | .unsol_event = alc_automute_amp_unsol_event, |
| 10163 | .setup = alc888_acer_aspire_6530g_setup, |
| 10164 | .init_hook = alc_automute_amp, |
| 10165 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10166 | [ALC883_MEDION] = { |
| 10167 | .mixers = { alc883_fivestack_mixer, |
| 10168 | alc883_chmode_mixer }, |
| 10169 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10170 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10171 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10172 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10173 | .adc_nids = alc883_adc_nids_alt, |
| 10174 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10175 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10176 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10177 | .channel_mode = alc883_sixstack_modes, |
| 10178 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10179 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10180 | [ALC883_MEDION_MD2] = { |
| 10181 | .mixers = { alc883_medion_md2_mixer}, |
| 10182 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 10183 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10184 | .dac_nids = alc883_dac_nids, |
| 10185 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10186 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10187 | .channel_mode = alc883_3ST_2ch_modes, |
| 10188 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10189 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10190 | .setup = alc883_medion_md2_setup, |
| 10191 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10192 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10193 | [ALC883_MEDION_WIM2160] = { |
| 10194 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10195 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10196 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10197 | .dac_nids = alc883_dac_nids, |
| 10198 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10199 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10200 | .adc_nids = alc883_adc_nids, |
| 10201 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10202 | .channel_mode = alc883_3ST_2ch_modes, |
| 10203 | .input_mux = &alc883_capture_source, |
| 10204 | .unsol_event = alc_automute_amp_unsol_event, |
| 10205 | .setup = alc883_medion_wim2160_setup, |
| 10206 | .init_hook = alc_automute_amp, |
| 10207 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10208 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10209 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10210 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10211 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10212 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10213 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10214 | .channel_mode = alc883_3ST_2ch_modes, |
| 10215 | .input_mux = &alc883_capture_source, |
| 10216 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10217 | [ALC883_CLEVO_M540R] = { |
| 10218 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10219 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10220 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10221 | .dac_nids = alc883_dac_nids, |
| 10222 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10223 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10224 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10225 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10226 | .need_dac_fix = 1, |
| 10227 | .input_mux = &alc883_capture_source, |
| 10228 | /* This machine has the hardware HP auto-muting, thus |
| 10229 | * we need no software mute via unsol event |
| 10230 | */ |
| 10231 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10232 | [ALC883_CLEVO_M720] = { |
| 10233 | .mixers = { alc883_clevo_m720_mixer }, |
| 10234 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10235 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10236 | .dac_nids = alc883_dac_nids, |
| 10237 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10238 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10239 | .channel_mode = alc883_3ST_2ch_modes, |
| 10240 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10241 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10242 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10243 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10244 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10245 | [ALC883_LENOVO_101E_2ch] = { |
| 10246 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10247 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10248 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10249 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10250 | .adc_nids = alc883_adc_nids_alt, |
| 10251 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10252 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10253 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10254 | .channel_mode = alc883_3ST_2ch_modes, |
| 10255 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 10256 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 10257 | .init_hook = alc883_lenovo_101e_all_automute, |
| 10258 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10259 | [ALC883_LENOVO_NB0763] = { |
| 10260 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10261 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10262 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10263 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10264 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10265 | .channel_mode = alc883_3ST_2ch_modes, |
| 10266 | .need_dac_fix = 1, |
| 10267 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10268 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10269 | .setup = alc883_medion_md2_setup, |
| 10270 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10271 | }, |
| 10272 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10273 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10274 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10275 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10276 | .dac_nids = alc883_dac_nids, |
| 10277 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10278 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10279 | .channel_mode = alc883_3ST_6ch_modes, |
| 10280 | .need_dac_fix = 1, |
| 10281 | .input_mux = &alc883_capture_source, |
| 10282 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 10283 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10284 | }, |
| 10285 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10286 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10287 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10288 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10289 | .dac_nids = alc883_dac_nids, |
| 10290 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10291 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10292 | .channel_mode = alc883_3ST_2ch_modes, |
| 10293 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10294 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10295 | .setup = alc883_haier_w66_setup, |
| 10296 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10297 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10298 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10299 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10300 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10301 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10302 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10303 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10304 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10305 | .need_dac_fix = 1, |
| 10306 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10307 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10308 | .setup = alc888_3st_hp_setup, |
| 10309 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10310 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10311 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10312 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10313 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10314 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10315 | .dac_nids = alc883_dac_nids, |
| 10316 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10317 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10318 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10319 | .channel_mode = alc883_sixstack_modes, |
| 10320 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10321 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10322 | .setup = alc888_6st_dell_setup, |
| 10323 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10324 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10325 | [ALC883_MITAC] = { |
| 10326 | .mixers = { alc883_mitac_mixer }, |
| 10327 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10328 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10329 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10330 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10331 | .channel_mode = alc883_3ST_2ch_modes, |
| 10332 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10333 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10334 | .setup = alc883_mitac_setup, |
| 10335 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10336 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10337 | [ALC883_FUJITSU_PI2515] = { |
| 10338 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10339 | .init_verbs = { alc883_init_verbs, |
| 10340 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10341 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10342 | .dac_nids = alc883_dac_nids, |
| 10343 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10344 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10345 | .channel_mode = alc883_3ST_2ch_modes, |
| 10346 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10347 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10348 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10349 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10350 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10351 | [ALC888_FUJITSU_XA3530] = { |
| 10352 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10353 | .init_verbs = { alc883_init_verbs, |
| 10354 | alc888_fujitsu_xa3530_verbs }, |
| 10355 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10356 | .dac_nids = alc883_dac_nids, |
| 10357 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10358 | .adc_nids = alc883_adc_nids_rev, |
| 10359 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10360 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10361 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10362 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10363 | .num_mux_defs = |
| 10364 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10365 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10366 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10367 | .setup = alc888_fujitsu_xa3530_setup, |
| 10368 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10369 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10370 | [ALC888_LENOVO_SKY] = { |
| 10371 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10372 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10373 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10374 | .dac_nids = alc883_dac_nids, |
| 10375 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10376 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10377 | .channel_mode = alc883_sixstack_modes, |
| 10378 | .need_dac_fix = 1, |
| 10379 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10380 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10381 | .setup = alc888_lenovo_sky_setup, |
| 10382 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10383 | }, |
| 10384 | [ALC888_ASUS_M90V] = { |
| 10385 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10386 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10387 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10388 | .dac_nids = alc883_dac_nids, |
| 10389 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10390 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10391 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10392 | .channel_mode = alc883_3ST_6ch_modes, |
| 10393 | .need_dac_fix = 1, |
| 10394 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10395 | .unsol_event = alc_sku_unsol_event, |
| 10396 | .setup = alc883_mode2_setup, |
| 10397 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10398 | }, |
| 10399 | [ALC888_ASUS_EEE1601] = { |
| 10400 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10401 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10402 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10403 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10404 | .dac_nids = alc883_dac_nids, |
| 10405 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10406 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10407 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10408 | .channel_mode = alc883_3ST_2ch_modes, |
| 10409 | .need_dac_fix = 1, |
| 10410 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10411 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10412 | .init_hook = alc883_eee1601_inithook, |
| 10413 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10414 | [ALC1200_ASUS_P5Q] = { |
| 10415 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10416 | .init_verbs = { alc883_init_verbs }, |
| 10417 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10418 | .dac_nids = alc883_dac_nids, |
| 10419 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10420 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10421 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10422 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10423 | .channel_mode = alc883_sixstack_modes, |
| 10424 | .input_mux = &alc883_capture_source, |
| 10425 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10426 | [ALC889A_MB31] = { |
| 10427 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10428 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10429 | alc880_gpio1_init_verbs }, |
| 10430 | .adc_nids = alc883_adc_nids, |
| 10431 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10432 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10433 | .dac_nids = alc883_dac_nids, |
| 10434 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10435 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10436 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10437 | .input_mux = &alc889A_mb31_capture_source, |
| 10438 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10439 | .unsol_event = alc889A_mb31_unsol_event, |
| 10440 | .init_hook = alc889A_mb31_automute, |
| 10441 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10442 | [ALC883_SONY_VAIO_TT] = { |
| 10443 | .mixers = { alc883_vaiott_mixer }, |
| 10444 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10445 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10446 | .dac_nids = alc883_dac_nids, |
| 10447 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10448 | .channel_mode = alc883_3ST_2ch_modes, |
| 10449 | .input_mux = &alc883_capture_source, |
| 10450 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10451 | .setup = alc883_vaiott_setup, |
| 10452 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10453 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10454 | }; |
| 10455 | |
| 10456 | |
| 10457 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10458 | * Pin config fixes |
| 10459 | */ |
| 10460 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10461 | PINFIX_ABIT_AW9D_MAX, |
| 10462 | PINFIX_PB_M5210, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10463 | }; |
| 10464 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10465 | static const struct alc_fixup alc882_fixups[] = { |
| 10466 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10467 | .pins = (const struct alc_pincfg[]) { |
| 10468 | { 0x15, 0x01080104 }, /* side */ |
| 10469 | { 0x16, 0x01011012 }, /* rear */ |
| 10470 | { 0x17, 0x01016011 }, /* clfe */ |
| 10471 | { } |
| 10472 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10473 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10474 | [PINFIX_PB_M5210] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10475 | .verbs = (const struct hda_verb[]) { |
| 10476 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10477 | {} |
| 10478 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10479 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10480 | }; |
| 10481 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10482 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10483 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10484 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 10485 | {} |
| 10486 | }; |
| 10487 | |
| 10488 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10489 | * BIOS auto configuration |
| 10490 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10491 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10492 | const struct auto_pin_cfg *cfg) |
| 10493 | { |
| 10494 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10495 | } |
| 10496 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10497 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10498 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10499 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10500 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10501 | int idx; |
| 10502 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10503 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10504 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10505 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10506 | if (dac == 0x25) |
| 10507 | idx = 4; |
| 10508 | else if (dac >= 0x02 && dac <= 0x05) |
| 10509 | idx = dac - 2; |
| 10510 | else |
| 10511 | return; |
| 10512 | 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] | 10513 | } |
| 10514 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10515 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10516 | { |
| 10517 | struct alc_spec *spec = codec->spec; |
| 10518 | int i; |
| 10519 | |
| 10520 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10521 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10522 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10523 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10524 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10525 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10526 | } |
| 10527 | } |
| 10528 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10529 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10530 | { |
| 10531 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10532 | hda_nid_t pin, dac; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10533 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10534 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10535 | if (pin) { |
| 10536 | dac = spec->multiout.hp_nid; |
| 10537 | if (!dac) |
| 10538 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10539 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10540 | } |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10541 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10542 | if (pin) { |
| 10543 | dac = spec->multiout.extra_out_nid[0]; |
| 10544 | if (!dac) |
| 10545 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10546 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10547 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10548 | } |
| 10549 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10550 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10551 | { |
| 10552 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10553 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10554 | int i; |
| 10555 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10556 | for (i = 0; i < cfg->num_inputs; i++) { |
| 10557 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 10558 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10559 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10560 | snd_hda_codec_write(codec, nid, 0, |
| 10561 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10562 | AMP_OUT_MUTE); |
| 10563 | } |
| 10564 | } |
| 10565 | |
| 10566 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10567 | { |
| 10568 | struct alc_spec *spec = codec->spec; |
| 10569 | int c; |
| 10570 | |
| 10571 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10572 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10573 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10574 | unsigned int mux_idx; |
| 10575 | const struct hda_input_mux *imux; |
| 10576 | int conns, mute, idx, item; |
| 10577 | |
| 10578 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10579 | ARRAY_SIZE(conn_list)); |
| 10580 | if (conns < 0) |
| 10581 | continue; |
| 10582 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10583 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10584 | if (!imux->num_items && mux_idx > 0) |
| 10585 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10586 | for (idx = 0; idx < conns; idx++) { |
| 10587 | /* if the current connection is the selected one, |
| 10588 | * unmute it as default - otherwise mute it |
| 10589 | */ |
| 10590 | mute = AMP_IN_MUTE(idx); |
| 10591 | for (item = 0; item < imux->num_items; item++) { |
| 10592 | if (imux->items[item].index == idx) { |
| 10593 | if (spec->cur_mux[c] == item) |
| 10594 | mute = AMP_IN_UNMUTE(idx); |
| 10595 | break; |
| 10596 | } |
| 10597 | } |
| 10598 | /* check if we have a selector or mixer |
| 10599 | * we could check for the widget type instead, but |
| 10600 | * just check for Amp-In presence (in case of mixer |
| 10601 | * without amp-in there is something wrong, this |
| 10602 | * function shouldn't be used or capsrc nid is wrong) |
| 10603 | */ |
| 10604 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10605 | snd_hda_codec_write(codec, nid, 0, |
| 10606 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10607 | mute); |
| 10608 | else if (mute != AMP_IN_MUTE(idx)) |
| 10609 | snd_hda_codec_write(codec, nid, 0, |
| 10610 | AC_VERB_SET_CONNECT_SEL, |
| 10611 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10612 | } |
| 10613 | } |
| 10614 | } |
| 10615 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10616 | /* add mic boosts if needed */ |
| 10617 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10618 | { |
| 10619 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10620 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 10621 | int i, err; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10622 | hda_nid_t nid; |
| 10623 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10624 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame^] | 10625 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10626 | break; |
| 10627 | nid = cfg->inputs[i].pin; |
| 10628 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
Takashi Iwai | b5786e8 | 2010-09-09 14:21:17 +0200 | [diff] [blame] | 10629 | char pinname[32], label[32]; |
| 10630 | snd_hda_get_input_pin_label(cfg, i, pinname); |
| 10631 | snprintf(label, sizeof(label), "%s Boost", pinname); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10632 | err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10633 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 10634 | if (err < 0) |
| 10635 | return err; |
| 10636 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10637 | } |
| 10638 | return 0; |
| 10639 | } |
| 10640 | |
| 10641 | /* almost identical with ALC880 parser... */ |
| 10642 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10643 | { |
| 10644 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10645 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10646 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10647 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10648 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10649 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10650 | if (err < 0) |
| 10651 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10652 | if (!spec->autocfg.line_outs) |
| 10653 | return 0; /* can't find valid BIOS pin config */ |
| 10654 | |
| 10655 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10656 | if (err < 0) |
| 10657 | return err; |
| 10658 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10659 | if (err < 0) |
| 10660 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10661 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10662 | "Headphone"); |
| 10663 | if (err < 0) |
| 10664 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10665 | err = alc880_auto_create_extra_out(spec, |
| 10666 | spec->autocfg.speaker_pins[0], |
| 10667 | "Speaker"); |
| 10668 | if (err < 0) |
| 10669 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10670 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10671 | if (err < 0) |
| 10672 | return err; |
| 10673 | |
| 10674 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10675 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10676 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10677 | |
| 10678 | if (spec->kctls.list) |
| 10679 | add_mixer(spec, spec->kctls.list); |
| 10680 | |
| 10681 | add_verb(spec, alc883_auto_init_verbs); |
| 10682 | /* if ADC 0x07 is available, initialize it, too */ |
| 10683 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10684 | add_verb(spec, alc882_adc1_init_verbs); |
| 10685 | |
| 10686 | spec->num_mux_defs = 1; |
| 10687 | spec->input_mux = &spec->private_imux[0]; |
| 10688 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10689 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10690 | |
| 10691 | err = alc_auto_add_mic_boost(codec); |
| 10692 | if (err < 0) |
| 10693 | return err; |
| 10694 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10695 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10696 | } |
| 10697 | |
| 10698 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10699 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10700 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10701 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10702 | alc882_auto_init_multi_out(codec); |
| 10703 | alc882_auto_init_hp_out(codec); |
| 10704 | alc882_auto_init_analog_input(codec); |
| 10705 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10706 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10707 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10708 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10709 | } |
| 10710 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10711 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10712 | { |
| 10713 | struct alc_spec *spec; |
| 10714 | int err, board_config; |
| 10715 | |
| 10716 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10717 | if (spec == NULL) |
| 10718 | return -ENOMEM; |
| 10719 | |
| 10720 | codec->spec = spec; |
| 10721 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10722 | alc_auto_parse_customize_define(codec); |
| 10723 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10724 | switch (codec->vendor_id) { |
| 10725 | case 0x10ec0882: |
| 10726 | case 0x10ec0885: |
| 10727 | break; |
| 10728 | default: |
| 10729 | /* ALC883 and variants */ |
| 10730 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10731 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10732 | } |
| 10733 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10734 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10735 | alc882_models, |
| 10736 | alc882_cfg_tbl); |
| 10737 | |
| 10738 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10739 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10740 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10741 | |
| 10742 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10743 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10744 | codec->chip_name); |
| 10745 | board_config = ALC882_AUTO; |
| 10746 | } |
| 10747 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10748 | if (board_config == ALC882_AUTO) |
| 10749 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10750 | |
| 10751 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10752 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10753 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10754 | if (err < 0) { |
| 10755 | alc_free(codec); |
| 10756 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10757 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10758 | printk(KERN_INFO |
| 10759 | "hda_codec: Cannot set up configuration " |
| 10760 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10761 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10762 | } |
| 10763 | } |
| 10764 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 10765 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 10766 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 10767 | if (err < 0) { |
| 10768 | alc_free(codec); |
| 10769 | return err; |
| 10770 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 10771 | } |
| 10772 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10773 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 10774 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10775 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10776 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 10777 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 10778 | /* FIXME: setup DAC5 */ |
| 10779 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 10780 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 10781 | |
| 10782 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 10783 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 10784 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10785 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10786 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10787 | spec->num_adc_nids = 0; |
| 10788 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10789 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10790 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10791 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10792 | hda_nid_t nid = alc882_adc_nids[i]; |
| 10793 | unsigned int wcap = get_wcaps(codec, nid); |
| 10794 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 10795 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10796 | if (wcap != AC_WID_AUD_IN) |
| 10797 | continue; |
| 10798 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 10799 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 10800 | if (err < 0) |
| 10801 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10802 | err = snd_hda_get_connections(codec, cap, items, |
| 10803 | ARRAY_SIZE(items)); |
| 10804 | if (err < 0) |
| 10805 | continue; |
| 10806 | for (j = 0; j < imux->num_items; j++) |
| 10807 | if (imux->items[j].index >= err) |
| 10808 | break; |
| 10809 | if (j < imux->num_items) |
| 10810 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10811 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 10812 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10813 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10814 | spec->adc_nids = spec->private_adc_nids; |
| 10815 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10816 | } |
| 10817 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 10818 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10819 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 10820 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10821 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10822 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10823 | if (board_config == ALC882_AUTO) |
| 10824 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); |
| 10825 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10826 | spec->vmaster_nid = 0x0c; |
| 10827 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10828 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10829 | if (board_config == ALC882_AUTO) |
| 10830 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10831 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10832 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10833 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10834 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10835 | |
| 10836 | return 0; |
| 10837 | } |
| 10838 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10839 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10840 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10841 | * ALC262 support |
| 10842 | */ |
| 10843 | |
| 10844 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 10845 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 10846 | |
| 10847 | #define alc262_dac_nids alc260_dac_nids |
| 10848 | #define alc262_adc_nids alc882_adc_nids |
| 10849 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10850 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 10851 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10852 | |
| 10853 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 10854 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10855 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10856 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 10857 | /* ADC0 */ |
| 10858 | 0x09 |
| 10859 | }; |
| 10860 | |
| 10861 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 10862 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10863 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 10864 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10865 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10866 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10867 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10868 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10869 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10870 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10871 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10872 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10873 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10874 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10875 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10876 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 10877 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10878 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 10879 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10880 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10881 | }; |
| 10882 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10883 | /* update HP, line and mono-out pins according to the master switch */ |
| 10884 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 10885 | { |
| 10886 | struct alc_spec *spec = codec->spec; |
| 10887 | int val = spec->master_sw; |
| 10888 | |
| 10889 | /* HP & line-out */ |
| 10890 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 10891 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10892 | val ? PIN_HP : 0); |
| 10893 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10894 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10895 | val ? PIN_HP : 0); |
| 10896 | /* mono (speaker) depending on the HP jack sense */ |
| 10897 | val = val && !spec->jack_present; |
| 10898 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 10899 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10900 | val ? PIN_OUT : 0); |
| 10901 | } |
| 10902 | |
| 10903 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 10904 | { |
| 10905 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10906 | |
| 10907 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10908 | alc262_hp_master_update(codec); |
| 10909 | } |
| 10910 | |
| 10911 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10912 | { |
| 10913 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10914 | return; |
| 10915 | alc262_hp_bpc_automute(codec); |
| 10916 | } |
| 10917 | |
| 10918 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 10919 | { |
| 10920 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10921 | |
| 10922 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10923 | alc262_hp_master_update(codec); |
| 10924 | } |
| 10925 | |
| 10926 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 10927 | unsigned int res) |
| 10928 | { |
| 10929 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10930 | return; |
| 10931 | alc262_hp_wildwest_automute(codec); |
| 10932 | } |
| 10933 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10934 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10935 | |
| 10936 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10937 | struct snd_ctl_elem_value *ucontrol) |
| 10938 | { |
| 10939 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10940 | struct alc_spec *spec = codec->spec; |
| 10941 | int val = !!*ucontrol->value.integer.value; |
| 10942 | |
| 10943 | if (val == spec->master_sw) |
| 10944 | return 0; |
| 10945 | spec->master_sw = val; |
| 10946 | alc262_hp_master_update(codec); |
| 10947 | return 1; |
| 10948 | } |
| 10949 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10950 | #define ALC262_HP_MASTER_SWITCH \ |
| 10951 | { \ |
| 10952 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10953 | .name = "Master Playback Switch", \ |
| 10954 | .info = snd_ctl_boolean_mono_info, \ |
| 10955 | .get = alc262_hp_master_sw_get, \ |
| 10956 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10957 | }, \ |
| 10958 | { \ |
| 10959 | .iface = NID_MAPPING, \ |
| 10960 | .name = "Master Playback Switch", \ |
| 10961 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10962 | } |
| 10963 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10964 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10965 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10966 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10967 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10968 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10969 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10970 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10971 | HDA_OUTPUT), |
| 10972 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10973 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10974 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10975 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10976 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10977 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10978 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10979 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10980 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10981 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10982 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10983 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10984 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10985 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10986 | { } /* end */ |
| 10987 | }; |
| 10988 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10989 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10990 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10991 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10992 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10993 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10994 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10995 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10996 | HDA_OUTPUT), |
| 10997 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10998 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10999 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11000 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11001 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11002 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11003 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11004 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11005 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11006 | { } /* end */ |
| 11007 | }; |
| 11008 | |
| 11009 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 11010 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11011 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11012 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11013 | { } /* end */ |
| 11014 | }; |
| 11015 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11016 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11017 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11018 | { |
| 11019 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11020 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11021 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11022 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11023 | } |
| 11024 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11025 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11026 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11027 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11028 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11029 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11030 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11031 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11032 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11033 | { } /* end */ |
| 11034 | }; |
| 11035 | |
| 11036 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 11037 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11038 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11039 | |
| 11040 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11041 | { } |
| 11042 | }; |
| 11043 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11044 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11045 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11046 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11047 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11048 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11049 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11050 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11051 | { } /* end */ |
| 11052 | }; |
| 11053 | |
| 11054 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 11055 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11056 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11057 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11058 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11059 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11060 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11061 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11062 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11063 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11064 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11065 | {} |
| 11066 | }; |
| 11067 | |
| 11068 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 11069 | .num_items = 1, |
| 11070 | .items = { |
| 11071 | { "Line", 0x1 }, |
| 11072 | }, |
| 11073 | }; |
| 11074 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11075 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 11076 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 11077 | { |
| 11078 | struct alc_spec *spec = codec->spec; |
| 11079 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11080 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11081 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11082 | unsigned int mute; |
| 11083 | |
| 11084 | /* HP */ |
| 11085 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 11086 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 11087 | HDA_AMP_MUTE, mute); |
| 11088 | /* mute internal speaker per jack sense */ |
| 11089 | if (spec->jack_present) |
| 11090 | mute = HDA_AMP_MUTE; |
| 11091 | if (line_nid) |
| 11092 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 11093 | HDA_AMP_MUTE, mute); |
| 11094 | if (speaker_nid && speaker_nid != line_nid) |
| 11095 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 11096 | HDA_AMP_MUTE, mute); |
| 11097 | } |
| 11098 | |
| 11099 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 11100 | |
| 11101 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11102 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11103 | { |
| 11104 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11105 | struct alc_spec *spec = codec->spec; |
| 11106 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11107 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11108 | if (val == spec->master_sw) |
| 11109 | return 0; |
| 11110 | spec->master_sw = val; |
| 11111 | alc262_hippo_master_update(codec); |
| 11112 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11113 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11114 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11115 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11116 | { \ |
| 11117 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11118 | .name = "Master Playback Switch", \ |
| 11119 | .info = snd_ctl_boolean_mono_info, \ |
| 11120 | .get = alc262_hippo_master_sw_get, \ |
| 11121 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11122 | }, \ |
| 11123 | { \ |
| 11124 | .iface = NID_MAPPING, \ |
| 11125 | .name = "Master Playback Switch", \ |
| 11126 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11127 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11128 | } |
| 11129 | |
| 11130 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11131 | ALC262_HIPPO_MASTER_SWITCH, |
| 11132 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11133 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11134 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11135 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11136 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11137 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11138 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11139 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11140 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11141 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11142 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11143 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11144 | { } /* end */ |
| 11145 | }; |
| 11146 | |
| 11147 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11148 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11149 | ALC262_HIPPO_MASTER_SWITCH, |
| 11150 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11151 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11152 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11153 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11154 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11155 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11156 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11157 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11158 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11159 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11160 | { } /* end */ |
| 11161 | }; |
| 11162 | |
| 11163 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11164 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 11165 | { |
| 11166 | struct alc_spec *spec = codec->spec; |
| 11167 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11168 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11169 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11170 | alc262_hippo_master_update(codec); |
| 11171 | } |
| 11172 | |
| 11173 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11174 | { |
| 11175 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11176 | return; |
| 11177 | alc262_hippo_automute(codec); |
| 11178 | } |
| 11179 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11180 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11181 | { |
| 11182 | struct alc_spec *spec = codec->spec; |
| 11183 | |
| 11184 | spec->autocfg.hp_pins[0] = 0x15; |
| 11185 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11186 | } |
| 11187 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11188 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11189 | { |
| 11190 | struct alc_spec *spec = codec->spec; |
| 11191 | |
| 11192 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11193 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11194 | } |
| 11195 | |
| 11196 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11197 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11198 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11199 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11200 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11201 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11202 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11203 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11204 | { } /* end */ |
| 11205 | }; |
| 11206 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11207 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11208 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11209 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11210 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11211 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11212 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11213 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11214 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11215 | { } /* end */ |
| 11216 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11217 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11218 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11219 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11220 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11221 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11222 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11223 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11224 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11225 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11226 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11227 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11228 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11229 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11230 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11231 | { } /* end */ |
| 11232 | }; |
| 11233 | |
| 11234 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11235 | /* Headphone automute */ |
| 11236 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11237 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11238 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11239 | |
| 11240 | /* P11 AUX_IN, white 4-pin connector */ |
| 11241 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11242 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11243 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11244 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11245 | |
| 11246 | {} |
| 11247 | }; |
| 11248 | |
| 11249 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11250 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11251 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11252 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11253 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11254 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11255 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11256 | } |
| 11257 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11258 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11259 | #define alc262_capture_mixer alc882_capture_mixer |
| 11260 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11261 | |
| 11262 | /* |
| 11263 | * generic initialization of ADC, input mixers and output mixers |
| 11264 | */ |
| 11265 | static struct hda_verb alc262_init_verbs[] = { |
| 11266 | /* |
| 11267 | * Unmute ADC0-2 and set the default input to mic-in |
| 11268 | */ |
| 11269 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11270 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11271 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11272 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11273 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11274 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11275 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11276 | /* 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] | 11277 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11278 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11279 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11280 | */ |
| 11281 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11282 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11283 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11284 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11285 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11286 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11287 | |
| 11288 | /* |
| 11289 | * Set up output mixers (0x0c - 0x0e) |
| 11290 | */ |
| 11291 | /* set vol=0 to output mixers */ |
| 11292 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11293 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11294 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11295 | /* set up input amps for analog loopback */ |
| 11296 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11297 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11298 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11299 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11300 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11301 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11302 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11303 | |
| 11304 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11305 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11306 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11307 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11308 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11309 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11310 | |
| 11311 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11312 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11313 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11314 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11315 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11316 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11317 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11318 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11319 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11320 | /* FIXME: use matrix-type input source selection */ |
| 11321 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11322 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11323 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11324 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11325 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11326 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11327 | /* Input mixer2 */ |
| 11328 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11329 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11330 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11331 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11332 | /* Input mixer3 */ |
| 11333 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11334 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11335 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11336 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11337 | |
| 11338 | { } |
| 11339 | }; |
| 11340 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11341 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11342 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11343 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11344 | { } |
| 11345 | }; |
| 11346 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11347 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11348 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11349 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11350 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11351 | |
| 11352 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11353 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11354 | {} |
| 11355 | }; |
| 11356 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11357 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11358 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11359 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11360 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11361 | |
| 11362 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11363 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11364 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11365 | }; |
| 11366 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11367 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11368 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11369 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11370 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11371 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11372 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11373 | { } /* end */ |
| 11374 | }; |
| 11375 | |
| 11376 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11377 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11378 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11379 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11380 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11381 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11382 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11383 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11384 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11385 | {} |
| 11386 | }; |
| 11387 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11388 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11389 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11390 | struct alc_spec *spec = codec->spec; |
| 11391 | |
| 11392 | spec->autocfg.hp_pins[0] = 0x15; |
| 11393 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11394 | spec->ext_mic.pin = 0x18; |
| 11395 | spec->ext_mic.mux_idx = 0; |
| 11396 | spec->int_mic.pin = 0x12; |
| 11397 | spec->int_mic.mux_idx = 9; |
| 11398 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11399 | } |
| 11400 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11401 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11402 | * nec model |
| 11403 | * 0x15 = headphone |
| 11404 | * 0x16 = internal speaker |
| 11405 | * 0x18 = external mic |
| 11406 | */ |
| 11407 | |
| 11408 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11409 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11410 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11411 | |
| 11412 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11413 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11414 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11415 | |
| 11416 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11417 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11418 | { } /* end */ |
| 11419 | }; |
| 11420 | |
| 11421 | static struct hda_verb alc262_nec_verbs[] = { |
| 11422 | /* Unmute Speaker */ |
| 11423 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11424 | |
| 11425 | /* Headphone */ |
| 11426 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11427 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11428 | |
| 11429 | /* External mic to headphone */ |
| 11430 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11431 | /* External mic to speaker */ |
| 11432 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11433 | {} |
| 11434 | }; |
| 11435 | |
| 11436 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11437 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11438 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11439 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11440 | */ |
| 11441 | |
| 11442 | #define ALC_HP_EVENT 0x37 |
| 11443 | |
| 11444 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11445 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11446 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11447 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11448 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11449 | {} |
| 11450 | }; |
| 11451 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11452 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11453 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11454 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11455 | {} |
| 11456 | }; |
| 11457 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11458 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11459 | /* Front Mic pin: input vref at 50% */ |
| 11460 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11461 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11462 | {} |
| 11463 | }; |
| 11464 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11465 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11466 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11467 | .items = { |
| 11468 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11469 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11470 | { "CD", 0x4 }, |
| 11471 | }, |
| 11472 | }; |
| 11473 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11474 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11475 | .num_items = 5, |
| 11476 | .items = { |
| 11477 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11478 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11479 | { "Line", 0x2 }, |
| 11480 | { "CD", 0x4 }, |
| 11481 | { "AUX IN", 0x6 }, |
| 11482 | }, |
| 11483 | }; |
| 11484 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11485 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11486 | .num_items = 4, |
| 11487 | .items = { |
| 11488 | { "Mic", 0x0 }, |
| 11489 | { "Front Mic", 0x2 }, |
| 11490 | { "Line", 0x1 }, |
| 11491 | { "CD", 0x4 }, |
| 11492 | }, |
| 11493 | }; |
| 11494 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11495 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11496 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11497 | { |
| 11498 | struct alc_spec *spec = codec->spec; |
| 11499 | unsigned int mute; |
| 11500 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11501 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11502 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11503 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11504 | spec->sense_updated = 1; |
| 11505 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11506 | /* unmute internal speaker only if both HPs are unplugged and |
| 11507 | * master switch is on |
| 11508 | */ |
| 11509 | if (spec->jack_present) |
| 11510 | mute = HDA_AMP_MUTE; |
| 11511 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11512 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11513 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11514 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11515 | } |
| 11516 | |
| 11517 | /* unsolicited event for HP jack sensing */ |
| 11518 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11519 | unsigned int res) |
| 11520 | { |
| 11521 | if ((res >> 26) != ALC_HP_EVENT) |
| 11522 | return; |
| 11523 | alc262_fujitsu_automute(codec, 1); |
| 11524 | } |
| 11525 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11526 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11527 | { |
| 11528 | alc262_fujitsu_automute(codec, 1); |
| 11529 | } |
| 11530 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11531 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11532 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11533 | .ops = &snd_hda_bind_vol, |
| 11534 | .values = { |
| 11535 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11536 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11537 | 0 |
| 11538 | }, |
| 11539 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11540 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11541 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11542 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11543 | { |
| 11544 | struct alc_spec *spec = codec->spec; |
| 11545 | unsigned int mute; |
| 11546 | |
| 11547 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11548 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11549 | spec->sense_updated = 1; |
| 11550 | } |
| 11551 | if (spec->jack_present) { |
| 11552 | /* mute internal speaker */ |
| 11553 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11554 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11555 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11556 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11557 | } else { |
| 11558 | /* unmute internal speaker if necessary */ |
| 11559 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11560 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11561 | HDA_AMP_MUTE, mute); |
| 11562 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11563 | HDA_AMP_MUTE, mute); |
| 11564 | } |
| 11565 | } |
| 11566 | |
| 11567 | /* unsolicited event for HP jack sensing */ |
| 11568 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11569 | unsigned int res) |
| 11570 | { |
| 11571 | if ((res >> 26) != ALC_HP_EVENT) |
| 11572 | return; |
| 11573 | alc262_lenovo_3000_automute(codec, 1); |
| 11574 | } |
| 11575 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11576 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11577 | int dir, int idx, long *valp) |
| 11578 | { |
| 11579 | int i, change = 0; |
| 11580 | |
| 11581 | for (i = 0; i < 2; i++, valp++) |
| 11582 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11583 | HDA_AMP_MUTE, |
| 11584 | *valp ? 0 : HDA_AMP_MUTE); |
| 11585 | return change; |
| 11586 | } |
| 11587 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11588 | /* bind hp and internal speaker mute (with plug check) */ |
| 11589 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11590 | struct snd_ctl_elem_value *ucontrol) |
| 11591 | { |
| 11592 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11593 | long *valp = ucontrol->value.integer.value; |
| 11594 | int change; |
| 11595 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11596 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11597 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11598 | if (change) |
| 11599 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11600 | return change; |
| 11601 | } |
| 11602 | |
| 11603 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11604 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11605 | { |
| 11606 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11607 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11608 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11609 | .info = snd_hda_mixer_amp_switch_info, |
| 11610 | .get = snd_hda_mixer_amp_switch_get, |
| 11611 | .put = alc262_fujitsu_master_sw_put, |
| 11612 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11613 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11614 | { |
| 11615 | .iface = NID_MAPPING, |
| 11616 | .name = "Master Playback Switch", |
| 11617 | .private_value = 0x1b, |
| 11618 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11619 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11620 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11621 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11622 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11623 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11624 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11625 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11626 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11627 | { } /* end */ |
| 11628 | }; |
| 11629 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11630 | /* bind hp and internal speaker mute (with plug check) */ |
| 11631 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11632 | struct snd_ctl_elem_value *ucontrol) |
| 11633 | { |
| 11634 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11635 | long *valp = ucontrol->value.integer.value; |
| 11636 | int change; |
| 11637 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11638 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11639 | if (change) |
| 11640 | alc262_lenovo_3000_automute(codec, 0); |
| 11641 | return change; |
| 11642 | } |
| 11643 | |
| 11644 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11645 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11646 | { |
| 11647 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11648 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11649 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11650 | .info = snd_hda_mixer_amp_switch_info, |
| 11651 | .get = snd_hda_mixer_amp_switch_get, |
| 11652 | .put = alc262_lenovo_3000_master_sw_put, |
| 11653 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11654 | }, |
| 11655 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11656 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11657 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11658 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11659 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11660 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11661 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11662 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11663 | { } /* end */ |
| 11664 | }; |
| 11665 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11666 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11667 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11668 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11669 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11670 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11671 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11672 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11673 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11674 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11675 | { } /* end */ |
| 11676 | }; |
| 11677 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11678 | /* additional init verbs for Benq laptops */ |
| 11679 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11680 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11681 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11682 | {} |
| 11683 | }; |
| 11684 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11685 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11686 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11687 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11688 | |
| 11689 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11690 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11691 | {} |
| 11692 | }; |
| 11693 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11694 | /* Samsung Q1 Ultra Vista model setup */ |
| 11695 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11696 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11697 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11698 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11699 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11700 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11701 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11702 | { } /* end */ |
| 11703 | }; |
| 11704 | |
| 11705 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11706 | /* output mixer */ |
| 11707 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11708 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11709 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11710 | /* speaker */ |
| 11711 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11712 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11713 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11714 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11715 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11716 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11717 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11718 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11719 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11720 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11721 | /* internal mic */ |
| 11722 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11723 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11724 | /* ADC, choose mic */ |
| 11725 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11726 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11727 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11728 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11729 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11730 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11731 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11732 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11733 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11734 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11735 | {} |
| 11736 | }; |
| 11737 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11738 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11739 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11740 | { |
| 11741 | struct alc_spec *spec = codec->spec; |
| 11742 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11743 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11744 | mute = 0; |
| 11745 | /* auto-mute only when HP is used as HP */ |
| 11746 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11747 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11748 | if (spec->jack_present) |
| 11749 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11750 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11751 | /* mute/unmute internal speaker */ |
| 11752 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11753 | HDA_AMP_MUTE, mute); |
| 11754 | /* mute/unmute HP */ |
| 11755 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11756 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11757 | } |
| 11758 | |
| 11759 | /* unsolicited event for HP jack sensing */ |
| 11760 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11761 | unsigned int res) |
| 11762 | { |
| 11763 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11764 | return; |
| 11765 | alc262_ultra_automute(codec); |
| 11766 | } |
| 11767 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11768 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 11769 | .num_items = 2, |
| 11770 | .items = { |
| 11771 | { "Mic", 0x1 }, |
| 11772 | { "Headphone", 0x7 }, |
| 11773 | }, |
| 11774 | }; |
| 11775 | |
| 11776 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11777 | struct snd_ctl_elem_value *ucontrol) |
| 11778 | { |
| 11779 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11780 | struct alc_spec *spec = codec->spec; |
| 11781 | int ret; |
| 11782 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11783 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11784 | if (!ret) |
| 11785 | return 0; |
| 11786 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 11787 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11788 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11789 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 11790 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 11791 | return ret; |
| 11792 | } |
| 11793 | |
| 11794 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 11795 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 11796 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 11797 | { |
| 11798 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11799 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11800 | .info = alc_mux_enum_info, |
| 11801 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11802 | .put = alc262_ultra_mux_enum_put, |
| 11803 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11804 | { |
| 11805 | .iface = NID_MAPPING, |
| 11806 | .name = "Capture Source", |
| 11807 | .private_value = 0x15, |
| 11808 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11809 | { } /* end */ |
| 11810 | }; |
| 11811 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11812 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 11813 | * and thus it's bound with a different mixer. |
| 11814 | * This function returns which mixer amp should be used. |
| 11815 | */ |
| 11816 | static int alc262_check_volbit(hda_nid_t nid) |
| 11817 | { |
| 11818 | if (!nid) |
| 11819 | return 0; |
| 11820 | else if (nid == 0x16) |
| 11821 | return 2; |
| 11822 | else |
| 11823 | return 1; |
| 11824 | } |
| 11825 | |
| 11826 | 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] | 11827 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11828 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11829 | unsigned long val; |
| 11830 | int vbit; |
| 11831 | |
| 11832 | vbit = alc262_check_volbit(nid); |
| 11833 | if (!vbit) |
| 11834 | return 0; |
| 11835 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 11836 | return 0; |
| 11837 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11838 | if (vbit == 2) |
| 11839 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 11840 | else |
| 11841 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11842 | 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] | 11843 | } |
| 11844 | |
| 11845 | 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] | 11846 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11847 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11848 | unsigned long val; |
| 11849 | |
| 11850 | if (!nid) |
| 11851 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11852 | if (nid == 0x16) |
| 11853 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 11854 | else |
| 11855 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11856 | 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] | 11857 | } |
| 11858 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11859 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11860 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11861 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11862 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11863 | const char *pfx; |
| 11864 | int vbits; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11865 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11866 | |
| 11867 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11868 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11869 | spec->multiout.dac_nids[0] = 2; |
| 11870 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11871 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 11872 | pfx = "Master"; |
| 11873 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11874 | pfx = "Speaker"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11875 | else if (cfg->line_out_type == AUTO_PIN_HP_OUT) |
| 11876 | pfx = "Headphone"; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11877 | else |
| 11878 | pfx = "Front"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11879 | for (i = 0; i < 2; i++) { |
| 11880 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); |
| 11881 | if (err < 0) |
| 11882 | return err; |
| 11883 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 11884 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 11885 | "Speaker", i); |
| 11886 | if (err < 0) |
| 11887 | return err; |
| 11888 | } |
| 11889 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 11890 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 11891 | "Headphone", i); |
| 11892 | if (err < 0) |
| 11893 | return err; |
| 11894 | } |
| 11895 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11896 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11897 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 11898 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 11899 | alc262_check_volbit(cfg->hp_pins[0]); |
| 11900 | if (vbits == 1 || vbits == 2) |
| 11901 | pfx = "Master"; /* only one mixer is used */ |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11902 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 11903 | for (i = 0; i < 2; i++) { |
| 11904 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 11905 | &vbits, i); |
| 11906 | if (err < 0) |
| 11907 | return err; |
| 11908 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 11909 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 11910 | "Speaker", &vbits, i); |
| 11911 | if (err < 0) |
| 11912 | return err; |
| 11913 | } |
| 11914 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 11915 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 11916 | "Headphone", &vbits, i); |
| 11917 | if (err < 0) |
| 11918 | return err; |
| 11919 | } |
| 11920 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11921 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11922 | } |
| 11923 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11924 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 11925 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11926 | |
| 11927 | /* |
| 11928 | * generic initialization of ADC, input mixers and output mixers |
| 11929 | */ |
| 11930 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 11931 | /* |
| 11932 | * Unmute ADC0-2 and set the default input to mic-in |
| 11933 | */ |
| 11934 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11935 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11936 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11937 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11938 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11939 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11940 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11941 | /* 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] | 11942 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11943 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11944 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11945 | */ |
| 11946 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11947 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11948 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11949 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11950 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11951 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11952 | |
| 11953 | /* |
| 11954 | * Set up output mixers (0x0c - 0x0f) |
| 11955 | */ |
| 11956 | /* set vol=0 to output mixers */ |
| 11957 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11958 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11959 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11960 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11961 | /* set up input amps for analog loopback */ |
| 11962 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11963 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11964 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11965 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11966 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11967 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11968 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11969 | |
| 11970 | /* FIXME: use matrix-type input source selection */ |
| 11971 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11972 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11973 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11974 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11975 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11976 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11977 | /* Input mixer2 */ |
| 11978 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11979 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11980 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11981 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11982 | /* Input mixer3 */ |
| 11983 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11984 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11985 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11986 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11987 | |
| 11988 | { } |
| 11989 | }; |
| 11990 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11991 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 11992 | /* |
| 11993 | * Unmute ADC0-2 and set the default input to mic-in |
| 11994 | */ |
| 11995 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11996 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11997 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11998 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11999 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12000 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12001 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12002 | /* 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] | 12003 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12004 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12005 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12006 | */ |
| 12007 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12008 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12009 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12010 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12011 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12012 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12013 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12014 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12015 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12016 | /* |
| 12017 | * Set up output mixers (0x0c - 0x0e) |
| 12018 | */ |
| 12019 | /* set vol=0 to output mixers */ |
| 12020 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12021 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12022 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12023 | |
| 12024 | /* set up input amps for analog loopback */ |
| 12025 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12026 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12027 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12028 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12029 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12030 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12031 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12032 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12033 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12034 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12035 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12036 | |
| 12037 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12038 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12039 | |
| 12040 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12041 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12042 | |
| 12043 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12044 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12045 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12046 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12047 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12048 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12049 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12050 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12051 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12052 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12053 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12054 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12055 | |
| 12056 | |
| 12057 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12058 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12059 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12060 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12061 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12062 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12063 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12064 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12065 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12066 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12067 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12068 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12069 | /* Input mixer2 */ |
| 12070 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12071 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12072 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12073 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12074 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12075 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12076 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12077 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12078 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12079 | /* Input mixer3 */ |
| 12080 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12081 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12082 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12083 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12084 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12085 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12086 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12087 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12088 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12089 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12090 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12091 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12092 | { } |
| 12093 | }; |
| 12094 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12095 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12096 | /* |
| 12097 | * Unmute ADC0-2 and set the default input to mic-in |
| 12098 | */ |
| 12099 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12100 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12101 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12102 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12103 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12104 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12105 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12106 | /* 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] | 12107 | * mixer widget |
| 12108 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12109 | * panel mic (mic 2) |
| 12110 | */ |
| 12111 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12112 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12113 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12114 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12115 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12116 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12117 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12118 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12119 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12120 | /* |
| 12121 | * Set up output mixers (0x0c - 0x0e) |
| 12122 | */ |
| 12123 | /* set vol=0 to output mixers */ |
| 12124 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12125 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12126 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12127 | |
| 12128 | /* set up input amps for analog loopback */ |
| 12129 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12130 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12131 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12132 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12133 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12134 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12135 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12136 | |
| 12137 | |
| 12138 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12139 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12140 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12141 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12142 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12143 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12144 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12145 | |
| 12146 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12147 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12148 | |
| 12149 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12150 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12151 | |
| 12152 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12153 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12154 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12155 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12156 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12157 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12158 | |
| 12159 | /* FIXME: use matrix-type input source selection */ |
| 12160 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12161 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12162 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12163 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12164 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12165 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12166 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12167 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12168 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12169 | /* Input mixer2 */ |
| 12170 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12171 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12172 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12173 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12174 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12175 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12176 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12177 | /* Input mixer3 */ |
| 12178 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12179 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12180 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12181 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12182 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12183 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12184 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12185 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12186 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12187 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12188 | { } |
| 12189 | }; |
| 12190 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12191 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12192 | |
| 12193 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12194 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12195 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12196 | |
| 12197 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12198 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12199 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12200 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12201 | |
| 12202 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12203 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12204 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12205 | {} |
| 12206 | }; |
| 12207 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12208 | /* |
| 12209 | * Pin config fixes |
| 12210 | */ |
| 12211 | enum { |
| 12212 | PINFIX_FSC_H270, |
| 12213 | }; |
| 12214 | |
| 12215 | static const struct alc_fixup alc262_fixups[] = { |
| 12216 | [PINFIX_FSC_H270] = { |
| 12217 | .pins = (const struct alc_pincfg[]) { |
| 12218 | { 0x14, 0x99130110 }, /* speaker */ |
| 12219 | { 0x15, 0x0221142f }, /* front HP */ |
| 12220 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12221 | { } |
| 12222 | } |
| 12223 | }, |
| 12224 | [PINFIX_PB_M5210] = { |
| 12225 | .verbs = (const struct hda_verb[]) { |
| 12226 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 12227 | {} |
| 12228 | } |
| 12229 | }, |
| 12230 | }; |
| 12231 | |
| 12232 | static struct snd_pci_quirk alc262_fixup_tbl[] = { |
| 12233 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12234 | {} |
| 12235 | }; |
| 12236 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12237 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12238 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12239 | #define alc262_loopbacks alc880_loopbacks |
| 12240 | #endif |
| 12241 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12242 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12243 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12244 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12245 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12246 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12247 | |
| 12248 | /* |
| 12249 | * BIOS auto configuration |
| 12250 | */ |
| 12251 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12252 | { |
| 12253 | struct alc_spec *spec = codec->spec; |
| 12254 | int err; |
| 12255 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12256 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12257 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12258 | alc262_ignore); |
| 12259 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12260 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12261 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12262 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12263 | spec->multiout.max_channels = 2; |
| 12264 | spec->no_analog = 1; |
| 12265 | goto dig_only; |
| 12266 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12267 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12268 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12269 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12270 | if (err < 0) |
| 12271 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12272 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12273 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12274 | return err; |
| 12275 | |
| 12276 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12277 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12278 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12279 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12280 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12281 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12282 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12283 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12284 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12285 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12286 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12287 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12288 | err = alc_auto_add_mic_boost(codec); |
| 12289 | if (err < 0) |
| 12290 | return err; |
| 12291 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12292 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12293 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12294 | return 1; |
| 12295 | } |
| 12296 | |
| 12297 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12298 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12299 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12300 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12301 | |
| 12302 | |
| 12303 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12304 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12305 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12306 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12307 | alc262_auto_init_multi_out(codec); |
| 12308 | alc262_auto_init_hp_out(codec); |
| 12309 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12310 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12311 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12312 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12313 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12314 | } |
| 12315 | |
| 12316 | /* |
| 12317 | * configuration and preset |
| 12318 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12319 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 12320 | [ALC262_BASIC] = "basic", |
| 12321 | [ALC262_HIPPO] = "hippo", |
| 12322 | [ALC262_HIPPO_1] = "hippo_1", |
| 12323 | [ALC262_FUJITSU] = "fujitsu", |
| 12324 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12325 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12326 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12327 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12328 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12329 | [ALC262_BENQ_T31] = "benq-t31", |
| 12330 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12331 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12332 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12333 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12334 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12335 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12336 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12337 | [ALC262_AUTO] = "auto", |
| 12338 | }; |
| 12339 | |
| 12340 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12341 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12342 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12343 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12344 | ALC262_HP_BPC), |
| 12345 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12346 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12347 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12348 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12349 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12350 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12351 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12352 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12353 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12354 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12355 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12356 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12357 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12358 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12359 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12360 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12361 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12362 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12363 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12364 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12365 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12366 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12367 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12368 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12369 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12370 | #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] | 12371 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12372 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12373 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12374 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12375 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12376 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12377 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12378 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12379 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12380 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12381 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12382 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12383 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12384 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12385 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12386 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12387 | {} |
| 12388 | }; |
| 12389 | |
| 12390 | static struct alc_config_preset alc262_presets[] = { |
| 12391 | [ALC262_BASIC] = { |
| 12392 | .mixers = { alc262_base_mixer }, |
| 12393 | .init_verbs = { alc262_init_verbs }, |
| 12394 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12395 | .dac_nids = alc262_dac_nids, |
| 12396 | .hp_nid = 0x03, |
| 12397 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12398 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12399 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12400 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12401 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12402 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12403 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12404 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12405 | .dac_nids = alc262_dac_nids, |
| 12406 | .hp_nid = 0x03, |
| 12407 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12408 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12409 | .channel_mode = alc262_modes, |
| 12410 | .input_mux = &alc262_capture_source, |
| 12411 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12412 | .setup = alc262_hippo_setup, |
| 12413 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12414 | }, |
| 12415 | [ALC262_HIPPO_1] = { |
| 12416 | .mixers = { alc262_hippo1_mixer }, |
| 12417 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12418 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12419 | .dac_nids = alc262_dac_nids, |
| 12420 | .hp_nid = 0x02, |
| 12421 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12422 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12423 | .channel_mode = alc262_modes, |
| 12424 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12425 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12426 | .setup = alc262_hippo1_setup, |
| 12427 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12428 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12429 | [ALC262_FUJITSU] = { |
| 12430 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12431 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12432 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12433 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12434 | .dac_nids = alc262_dac_nids, |
| 12435 | .hp_nid = 0x03, |
| 12436 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12437 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12438 | .channel_mode = alc262_modes, |
| 12439 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12440 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12441 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12442 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12443 | [ALC262_HP_BPC] = { |
| 12444 | .mixers = { alc262_HP_BPC_mixer }, |
| 12445 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12446 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12447 | .dac_nids = alc262_dac_nids, |
| 12448 | .hp_nid = 0x03, |
| 12449 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12450 | .channel_mode = alc262_modes, |
| 12451 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12452 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12453 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12454 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12455 | [ALC262_HP_BPC_D7000_WF] = { |
| 12456 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12457 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12458 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12459 | .dac_nids = alc262_dac_nids, |
| 12460 | .hp_nid = 0x03, |
| 12461 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12462 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12463 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12464 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12465 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12466 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12467 | [ALC262_HP_BPC_D7000_WL] = { |
| 12468 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12469 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12470 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12471 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12472 | .dac_nids = alc262_dac_nids, |
| 12473 | .hp_nid = 0x03, |
| 12474 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12475 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12476 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12477 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12478 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12479 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12480 | [ALC262_HP_TC_T5735] = { |
| 12481 | .mixers = { alc262_hp_t5735_mixer }, |
| 12482 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12483 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12484 | .dac_nids = alc262_dac_nids, |
| 12485 | .hp_nid = 0x03, |
| 12486 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12487 | .channel_mode = alc262_modes, |
| 12488 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12489 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12490 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12491 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12492 | }, |
| 12493 | [ALC262_HP_RP5700] = { |
| 12494 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12495 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12496 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12497 | .dac_nids = alc262_dac_nids, |
| 12498 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12499 | .channel_mode = alc262_modes, |
| 12500 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12501 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12502 | [ALC262_BENQ_ED8] = { |
| 12503 | .mixers = { alc262_base_mixer }, |
| 12504 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12505 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12506 | .dac_nids = alc262_dac_nids, |
| 12507 | .hp_nid = 0x03, |
| 12508 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12509 | .channel_mode = alc262_modes, |
| 12510 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12511 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12512 | [ALC262_SONY_ASSAMD] = { |
| 12513 | .mixers = { alc262_sony_mixer }, |
| 12514 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12515 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12516 | .dac_nids = alc262_dac_nids, |
| 12517 | .hp_nid = 0x02, |
| 12518 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12519 | .channel_mode = alc262_modes, |
| 12520 | .input_mux = &alc262_capture_source, |
| 12521 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12522 | .setup = alc262_hippo_setup, |
| 12523 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12524 | }, |
| 12525 | [ALC262_BENQ_T31] = { |
| 12526 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12527 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12528 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12529 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12530 | .dac_nids = alc262_dac_nids, |
| 12531 | .hp_nid = 0x03, |
| 12532 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12533 | .channel_mode = alc262_modes, |
| 12534 | .input_mux = &alc262_capture_source, |
| 12535 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12536 | .setup = alc262_hippo_setup, |
| 12537 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12538 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12539 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12540 | .mixers = { alc262_ultra_mixer }, |
| 12541 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12542 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12543 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12544 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12545 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12546 | .channel_mode = alc262_modes, |
| 12547 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12548 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12549 | .capsrc_nids = alc262_capsrc_nids, |
| 12550 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12551 | .unsol_event = alc262_ultra_unsol_event, |
| 12552 | .init_hook = alc262_ultra_automute, |
| 12553 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12554 | [ALC262_LENOVO_3000] = { |
| 12555 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12556 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12557 | alc262_lenovo_3000_unsol_verbs, |
| 12558 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12559 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12560 | .dac_nids = alc262_dac_nids, |
| 12561 | .hp_nid = 0x03, |
| 12562 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12563 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12564 | .channel_mode = alc262_modes, |
| 12565 | .input_mux = &alc262_fujitsu_capture_source, |
| 12566 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12567 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12568 | [ALC262_NEC] = { |
| 12569 | .mixers = { alc262_nec_mixer }, |
| 12570 | .init_verbs = { alc262_nec_verbs }, |
| 12571 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12572 | .dac_nids = alc262_dac_nids, |
| 12573 | .hp_nid = 0x03, |
| 12574 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12575 | .channel_mode = alc262_modes, |
| 12576 | .input_mux = &alc262_capture_source, |
| 12577 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12578 | [ALC262_TOSHIBA_S06] = { |
| 12579 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12580 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12581 | alc262_eapd_verbs }, |
| 12582 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12583 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12584 | .dac_nids = alc262_dac_nids, |
| 12585 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12586 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12587 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12588 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12589 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12590 | .unsol_event = alc_sku_unsol_event, |
| 12591 | .setup = alc262_toshiba_s06_setup, |
| 12592 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12593 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12594 | [ALC262_TOSHIBA_RX1] = { |
| 12595 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12596 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12597 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12598 | .dac_nids = alc262_dac_nids, |
| 12599 | .hp_nid = 0x03, |
| 12600 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12601 | .channel_mode = alc262_modes, |
| 12602 | .input_mux = &alc262_capture_source, |
| 12603 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12604 | .setup = alc262_hippo_setup, |
| 12605 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12606 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12607 | [ALC262_TYAN] = { |
| 12608 | .mixers = { alc262_tyan_mixer }, |
| 12609 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12610 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12611 | .dac_nids = alc262_dac_nids, |
| 12612 | .hp_nid = 0x02, |
| 12613 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12614 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12615 | .channel_mode = alc262_modes, |
| 12616 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12617 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12618 | .setup = alc262_tyan_setup, |
| 12619 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12620 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12621 | }; |
| 12622 | |
| 12623 | static int patch_alc262(struct hda_codec *codec) |
| 12624 | { |
| 12625 | struct alc_spec *spec; |
| 12626 | int board_config; |
| 12627 | int err; |
| 12628 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12629 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12630 | if (spec == NULL) |
| 12631 | return -ENOMEM; |
| 12632 | |
| 12633 | codec->spec = spec; |
| 12634 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12635 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12636 | * under-run |
| 12637 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12638 | { |
| 12639 | int tmp; |
| 12640 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12641 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12642 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12643 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12644 | } |
| 12645 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12646 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12647 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12648 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12649 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12650 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12651 | alc262_models, |
| 12652 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12653 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12654 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12655 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12656 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12657 | board_config = ALC262_AUTO; |
| 12658 | } |
| 12659 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12660 | if (board_config == ALC262_AUTO) |
| 12661 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1); |
| 12662 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12663 | if (board_config == ALC262_AUTO) { |
| 12664 | /* automatic parse from the BIOS config */ |
| 12665 | err = alc262_parse_auto_config(codec); |
| 12666 | if (err < 0) { |
| 12667 | alc_free(codec); |
| 12668 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12669 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12670 | printk(KERN_INFO |
| 12671 | "hda_codec: Cannot set up configuration " |
| 12672 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12673 | board_config = ALC262_BASIC; |
| 12674 | } |
| 12675 | } |
| 12676 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12677 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12678 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12679 | if (err < 0) { |
| 12680 | alc_free(codec); |
| 12681 | return err; |
| 12682 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12683 | } |
| 12684 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12685 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12686 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12687 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12688 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12689 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12690 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12691 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12692 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12693 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12694 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12695 | int i; |
| 12696 | /* check whether the digital-mic has to be supported */ |
| 12697 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12698 | if (spec->input_mux->items[i].index >= 9) |
| 12699 | break; |
| 12700 | } |
| 12701 | if (i < spec->input_mux->num_items) { |
| 12702 | /* use only ADC0 */ |
| 12703 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12704 | spec->num_adc_nids = 1; |
| 12705 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12706 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12707 | /* all analog inputs */ |
| 12708 | /* check whether NID 0x07 is valid */ |
| 12709 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12710 | |
| 12711 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12712 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12713 | if (wcap != AC_WID_AUD_IN) { |
| 12714 | spec->adc_nids = alc262_adc_nids_alt; |
| 12715 | spec->num_adc_nids = |
| 12716 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12717 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12718 | } else { |
| 12719 | spec->adc_nids = alc262_adc_nids; |
| 12720 | spec->num_adc_nids = |
| 12721 | ARRAY_SIZE(alc262_adc_nids); |
| 12722 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12723 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12724 | } |
| 12725 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12726 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12727 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12728 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12729 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12730 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12731 | if (board_config == ALC262_AUTO) |
| 12732 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0); |
| 12733 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12734 | spec->vmaster_nid = 0x0c; |
| 12735 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12736 | codec->patch_ops = alc_patch_ops; |
| 12737 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12738 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12739 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12740 | if (!spec->loopback.amplist) |
| 12741 | spec->loopback.amplist = alc262_loopbacks; |
| 12742 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12743 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12744 | return 0; |
| 12745 | } |
| 12746 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12747 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12748 | * ALC268 channel source setting (2 channel) |
| 12749 | */ |
| 12750 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12751 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12752 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12753 | static hda_nid_t alc268_dac_nids[2] = { |
| 12754 | /* front, hp */ |
| 12755 | 0x02, 0x03 |
| 12756 | }; |
| 12757 | |
| 12758 | static hda_nid_t alc268_adc_nids[2] = { |
| 12759 | /* ADC0-1 */ |
| 12760 | 0x08, 0x07 |
| 12761 | }; |
| 12762 | |
| 12763 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 12764 | /* ADC0 */ |
| 12765 | 0x08 |
| 12766 | }; |
| 12767 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12768 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 12769 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12770 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 12771 | /* output mixer control */ |
| 12772 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12773 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12774 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12775 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12776 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12777 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12778 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12779 | { } |
| 12780 | }; |
| 12781 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12782 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 12783 | /* output mixer control */ |
| 12784 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12785 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12786 | ALC262_HIPPO_MASTER_SWITCH, |
| 12787 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12788 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12789 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12790 | { } |
| 12791 | }; |
| 12792 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12793 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 12794 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 12795 | .ops = &snd_hda_bind_sw, |
| 12796 | .values = { |
| 12797 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 12798 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 12799 | 0 |
| 12800 | }, |
| 12801 | }; |
| 12802 | |
| 12803 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 12804 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 12805 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 12806 | { } |
| 12807 | }; |
| 12808 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12809 | static struct hda_verb alc268_eapd_verbs[] = { |
| 12810 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12811 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12812 | { } |
| 12813 | }; |
| 12814 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12815 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12816 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 12817 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12818 | { } /* end */ |
| 12819 | }; |
| 12820 | |
| 12821 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12822 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 12823 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 12824 | .ops = &snd_hda_bind_vol, |
| 12825 | .values = { |
| 12826 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12827 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12828 | 0 |
| 12829 | }, |
| 12830 | }; |
| 12831 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12832 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12833 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 12834 | { |
| 12835 | struct alc_spec *spec = codec->spec; |
| 12836 | unsigned int mute; |
| 12837 | |
| 12838 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12839 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12840 | spec->sense_updated = 1; |
| 12841 | } |
| 12842 | if (spec->jack_present) |
| 12843 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 12844 | else /* unmute internal speaker if necessary */ |
| 12845 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 12846 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12847 | HDA_AMP_MUTE, mute); |
| 12848 | } |
| 12849 | |
| 12850 | |
| 12851 | /* bind hp and internal speaker mute (with plug check) */ |
| 12852 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 12853 | struct snd_ctl_elem_value *ucontrol) |
| 12854 | { |
| 12855 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12856 | long *valp = ucontrol->value.integer.value; |
| 12857 | int change; |
| 12858 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 12859 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12860 | if (change) |
| 12861 | alc268_acer_automute(codec, 0); |
| 12862 | return change; |
| 12863 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12864 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12865 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 12866 | /* output mixer control */ |
| 12867 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12868 | { |
| 12869 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12870 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12871 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12872 | .info = snd_hda_mixer_amp_switch_info, |
| 12873 | .get = snd_hda_mixer_amp_switch_get, |
| 12874 | .put = alc268_acer_master_sw_put, |
| 12875 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12876 | }, |
| 12877 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 12878 | { } |
| 12879 | }; |
| 12880 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12881 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 12882 | /* output mixer control */ |
| 12883 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12884 | { |
| 12885 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12886 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12887 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12888 | .info = snd_hda_mixer_amp_switch_info, |
| 12889 | .get = snd_hda_mixer_amp_switch_get, |
| 12890 | .put = alc268_acer_master_sw_put, |
| 12891 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12892 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12893 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12894 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12895 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12896 | { } |
| 12897 | }; |
| 12898 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12899 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 12900 | /* output mixer control */ |
| 12901 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12902 | { |
| 12903 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12904 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12905 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12906 | .info = snd_hda_mixer_amp_switch_info, |
| 12907 | .get = snd_hda_mixer_amp_switch_get, |
| 12908 | .put = alc268_acer_master_sw_put, |
| 12909 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12910 | }, |
| 12911 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12912 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12913 | { } |
| 12914 | }; |
| 12915 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12916 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 12917 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12918 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12919 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12920 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12921 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 12922 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 12923 | { } |
| 12924 | }; |
| 12925 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12926 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12927 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 12928 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12929 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12930 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12931 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12932 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12933 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12934 | { } |
| 12935 | }; |
| 12936 | |
| 12937 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12938 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12939 | #define alc268_toshiba_setup alc262_hippo_setup |
| 12940 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12941 | |
| 12942 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 12943 | unsigned int res) |
| 12944 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12945 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12946 | return; |
| 12947 | alc268_acer_automute(codec, 1); |
| 12948 | } |
| 12949 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12950 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 12951 | { |
| 12952 | alc268_acer_automute(codec, 1); |
| 12953 | } |
| 12954 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12955 | /* toggle speaker-output according to the hp-jack state */ |
| 12956 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 12957 | { |
| 12958 | unsigned int present; |
| 12959 | unsigned char bits; |
| 12960 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12961 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12962 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12963 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12964 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12965 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12966 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12967 | } |
| 12968 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12969 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 12970 | unsigned int res) |
| 12971 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12972 | switch (res >> 26) { |
| 12973 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12974 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12975 | break; |
| 12976 | case ALC880_MIC_EVENT: |
| 12977 | alc_mic_automute(codec); |
| 12978 | break; |
| 12979 | } |
| 12980 | } |
| 12981 | |
| 12982 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 12983 | { |
| 12984 | struct alc_spec *spec = codec->spec; |
| 12985 | spec->ext_mic.pin = 0x18; |
| 12986 | spec->ext_mic.mux_idx = 0; |
| 12987 | spec->int_mic.pin = 0x12; |
| 12988 | spec->int_mic.mux_idx = 6; |
| 12989 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12990 | } |
| 12991 | |
| 12992 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 12993 | { |
| 12994 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12995 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12996 | } |
| 12997 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12998 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 12999 | /* output mixer control */ |
| 13000 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13001 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13002 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13003 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13004 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13005 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13006 | { } |
| 13007 | }; |
| 13008 | |
| 13009 | static struct hda_verb alc268_dell_verbs[] = { |
| 13010 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13011 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13012 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13013 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13014 | { } |
| 13015 | }; |
| 13016 | |
| 13017 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13018 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13019 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13020 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13021 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13022 | spec->autocfg.hp_pins[0] = 0x15; |
| 13023 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13024 | spec->ext_mic.pin = 0x18; |
| 13025 | spec->ext_mic.mux_idx = 0; |
| 13026 | spec->int_mic.pin = 0x19; |
| 13027 | spec->int_mic.mux_idx = 1; |
| 13028 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13029 | } |
| 13030 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13031 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 13032 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13033 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13034 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13035 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13036 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13037 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13038 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 13039 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 13040 | { } |
| 13041 | }; |
| 13042 | |
| 13043 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 13044 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13045 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13046 | { } |
| 13047 | }; |
| 13048 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13049 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13050 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13051 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13052 | spec->autocfg.hp_pins[0] = 0x15; |
| 13053 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13054 | spec->ext_mic.pin = 0x18; |
| 13055 | spec->ext_mic.mux_idx = 0; |
| 13056 | spec->int_mic.pin = 0x19; |
| 13057 | spec->int_mic.mux_idx = 1; |
| 13058 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13059 | } |
| 13060 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13061 | /* |
| 13062 | * generic initialization of ADC, input mixers and output mixers |
| 13063 | */ |
| 13064 | static struct hda_verb alc268_base_init_verbs[] = { |
| 13065 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13066 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13067 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13068 | |
| 13069 | /* |
| 13070 | * Set up output mixers (0x0c - 0x0e) |
| 13071 | */ |
| 13072 | /* set vol=0 to output mixers */ |
| 13073 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13074 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13075 | |
| 13076 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13077 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13078 | |
| 13079 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13080 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13081 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13082 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13083 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13084 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13085 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13086 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13087 | |
| 13088 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13089 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13090 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13091 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13092 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13093 | |
| 13094 | /* set PCBEEP vol = 0, mute connections */ |
| 13095 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13096 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13097 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13098 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13099 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13100 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13101 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13102 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13103 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13104 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13105 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13106 | { } |
| 13107 | }; |
| 13108 | |
| 13109 | /* |
| 13110 | * generic initialization of ADC, input mixers and output mixers |
| 13111 | */ |
| 13112 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 13113 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13114 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13115 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13116 | |
| 13117 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13118 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13119 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13120 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13121 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13122 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13123 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13124 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13125 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13126 | |
| 13127 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13128 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13129 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13130 | /* set PCBEEP vol = 0, mute connections */ |
| 13131 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13132 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13133 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13134 | |
| 13135 | { } |
| 13136 | }; |
| 13137 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13138 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13139 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13140 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13141 | { } /* end */ |
| 13142 | }; |
| 13143 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13144 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13145 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13146 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13147 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13148 | { } /* end */ |
| 13149 | }; |
| 13150 | |
| 13151 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13152 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13153 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13154 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13155 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13156 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13157 | { } /* end */ |
| 13158 | }; |
| 13159 | |
| 13160 | static struct hda_input_mux alc268_capture_source = { |
| 13161 | .num_items = 4, |
| 13162 | .items = { |
| 13163 | { "Mic", 0x0 }, |
| 13164 | { "Front Mic", 0x1 }, |
| 13165 | { "Line", 0x2 }, |
| 13166 | { "CD", 0x3 }, |
| 13167 | }, |
| 13168 | }; |
| 13169 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13170 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13171 | .num_items = 3, |
| 13172 | .items = { |
| 13173 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13174 | { "Internal Mic", 0x1 }, |
| 13175 | { "Line", 0x2 }, |
| 13176 | }, |
| 13177 | }; |
| 13178 | |
| 13179 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13180 | .num_items = 3, |
| 13181 | .items = { |
| 13182 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13183 | { "Internal Mic", 0x6 }, |
| 13184 | { "Line", 0x2 }, |
| 13185 | }, |
| 13186 | }; |
| 13187 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13188 | #ifdef CONFIG_SND_DEBUG |
| 13189 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13190 | /* Volume widgets */ |
| 13191 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13192 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13193 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13194 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13195 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13196 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13197 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13198 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13199 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13200 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13201 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13202 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13203 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13204 | /* The below appears problematic on some hardwares */ |
| 13205 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13206 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13207 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13208 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13209 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13210 | |
| 13211 | /* Modes for retasking pin widgets */ |
| 13212 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13213 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13214 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13215 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13216 | |
| 13217 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13218 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13219 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13220 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13221 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13222 | |
| 13223 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13224 | * The ALC268 does not have an SPDIF input. |
| 13225 | */ |
| 13226 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13227 | |
| 13228 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13229 | * this output to turn on an external amplifier. |
| 13230 | */ |
| 13231 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13232 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13233 | |
| 13234 | { } /* end */ |
| 13235 | }; |
| 13236 | #endif |
| 13237 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13238 | /* create input playback/capture controls for the given pin */ |
| 13239 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13240 | const char *ctlname, int idx) |
| 13241 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13242 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13243 | int err; |
| 13244 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13245 | switch (nid) { |
| 13246 | case 0x14: |
| 13247 | case 0x16: |
| 13248 | dac = 0x02; |
| 13249 | break; |
| 13250 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13251 | case 0x1a: /* ALC259/269 only */ |
| 13252 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13253 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13254 | dac = 0x03; |
| 13255 | break; |
| 13256 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13257 | snd_printd(KERN_WARNING "hda_codec: " |
| 13258 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13259 | return 0; |
| 13260 | } |
| 13261 | if (spec->multiout.dac_nids[0] != dac && |
| 13262 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13263 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13264 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13265 | HDA_OUTPUT)); |
| 13266 | if (err < 0) |
| 13267 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13268 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13269 | } |
| 13270 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13271 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13272 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13273 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13274 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13275 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13276 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13277 | if (err < 0) |
| 13278 | return err; |
| 13279 | return 0; |
| 13280 | } |
| 13281 | |
| 13282 | /* add playback controls from the parsed DAC table */ |
| 13283 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13284 | const struct auto_pin_cfg *cfg) |
| 13285 | { |
| 13286 | hda_nid_t nid; |
| 13287 | int err; |
| 13288 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13289 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13290 | |
| 13291 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13292 | if (nid) { |
| 13293 | const char *name; |
| 13294 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13295 | name = "Speaker"; |
| 13296 | else |
| 13297 | name = "Front"; |
| 13298 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13299 | if (err < 0) |
| 13300 | return err; |
| 13301 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13302 | |
| 13303 | nid = cfg->speaker_pins[0]; |
| 13304 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13305 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13306 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13307 | if (err < 0) |
| 13308 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13309 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13310 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13311 | if (err < 0) |
| 13312 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13313 | } |
| 13314 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13315 | if (nid) { |
| 13316 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13317 | if (err < 0) |
| 13318 | return err; |
| 13319 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13320 | |
| 13321 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13322 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13323 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13324 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13325 | if (err < 0) |
| 13326 | return err; |
| 13327 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13328 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13329 | } |
| 13330 | |
| 13331 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13332 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13333 | const struct auto_pin_cfg *cfg) |
| 13334 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13335 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13336 | } |
| 13337 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13338 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13339 | hda_nid_t nid, int pin_type) |
| 13340 | { |
| 13341 | int idx; |
| 13342 | |
| 13343 | alc_set_pin_output(codec, nid, pin_type); |
| 13344 | if (nid == 0x14 || nid == 0x16) |
| 13345 | idx = 0; |
| 13346 | else |
| 13347 | idx = 1; |
| 13348 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13349 | } |
| 13350 | |
| 13351 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13352 | { |
| 13353 | struct alc_spec *spec = codec->spec; |
| 13354 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 13355 | if (nid) { |
| 13356 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13357 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13358 | } |
| 13359 | } |
| 13360 | |
| 13361 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13362 | { |
| 13363 | struct alc_spec *spec = codec->spec; |
| 13364 | hda_nid_t pin; |
| 13365 | |
| 13366 | pin = spec->autocfg.hp_pins[0]; |
| 13367 | if (pin) |
| 13368 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 13369 | pin = spec->autocfg.speaker_pins[0]; |
| 13370 | if (pin) |
| 13371 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 13372 | } |
| 13373 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13374 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13375 | { |
| 13376 | struct alc_spec *spec = codec->spec; |
| 13377 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13378 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13379 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13380 | unsigned int dac_vol1, dac_vol2; |
| 13381 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13382 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13383 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13384 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13385 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13386 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13387 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13388 | AMP_IN_UNMUTE(1)); |
| 13389 | snd_hda_codec_write(codec, 0x10, 0, |
| 13390 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13391 | AMP_IN_UNMUTE(1)); |
| 13392 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13393 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13394 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13395 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13396 | snd_hda_codec_write(codec, 0x10, 0, |
| 13397 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13398 | } |
| 13399 | |
| 13400 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13401 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13402 | dac_vol2 = AMP_OUT_ZERO; |
| 13403 | else if (line_nid == 0x15) |
| 13404 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13405 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13406 | dac_vol2 = AMP_OUT_ZERO; |
| 13407 | else if (hp_nid == 0x15) |
| 13408 | dac_vol1 = AMP_OUT_ZERO; |
| 13409 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13410 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13411 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13412 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13413 | |
| 13414 | snd_hda_codec_write(codec, 0x02, 0, |
| 13415 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13416 | snd_hda_codec_write(codec, 0x03, 0, |
| 13417 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13418 | } |
| 13419 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13420 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13421 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13422 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13423 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13424 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13425 | |
| 13426 | /* |
| 13427 | * BIOS auto configuration |
| 13428 | */ |
| 13429 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13430 | { |
| 13431 | struct alc_spec *spec = codec->spec; |
| 13432 | int err; |
| 13433 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13434 | |
| 13435 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13436 | alc268_ignore); |
| 13437 | if (err < 0) |
| 13438 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13439 | if (!spec->autocfg.line_outs) { |
| 13440 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13441 | spec->multiout.max_channels = 2; |
| 13442 | spec->no_analog = 1; |
| 13443 | goto dig_only; |
| 13444 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13445 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13446 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13447 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13448 | if (err < 0) |
| 13449 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13450 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13451 | if (err < 0) |
| 13452 | return err; |
| 13453 | |
| 13454 | spec->multiout.max_channels = 2; |
| 13455 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13456 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13457 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13458 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13459 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13460 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13461 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13462 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13463 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13464 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13465 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13466 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13467 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13468 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13469 | err = alc_auto_add_mic_boost(codec); |
| 13470 | if (err < 0) |
| 13471 | return err; |
| 13472 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13473 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13474 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13475 | return 1; |
| 13476 | } |
| 13477 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13478 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13479 | |
| 13480 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13481 | static void alc268_auto_init(struct hda_codec *codec) |
| 13482 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13483 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13484 | alc268_auto_init_multi_out(codec); |
| 13485 | alc268_auto_init_hp_out(codec); |
| 13486 | alc268_auto_init_mono_speaker_out(codec); |
| 13487 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13488 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13489 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13490 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13491 | } |
| 13492 | |
| 13493 | /* |
| 13494 | * configuration and preset |
| 13495 | */ |
| 13496 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13497 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13498 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13499 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13500 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13501 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13502 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13503 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13504 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13505 | #ifdef CONFIG_SND_DEBUG |
| 13506 | [ALC268_TEST] = "test", |
| 13507 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13508 | [ALC268_AUTO] = "auto", |
| 13509 | }; |
| 13510 | |
| 13511 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13512 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13513 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13514 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13515 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13516 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13517 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13518 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13519 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13520 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13521 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13522 | /* almost compatible with toshiba but with optional digital outs; |
| 13523 | * auto-probing seems working fine |
| 13524 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13525 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13526 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13527 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13528 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13529 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13530 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13531 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13532 | {} |
| 13533 | }; |
| 13534 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13535 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13536 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13537 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13538 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13539 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13540 | ALC268_TOSHIBA), |
| 13541 | {} |
| 13542 | }; |
| 13543 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13544 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13545 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13546 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13547 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13548 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13549 | alc267_quanta_il1_verbs }, |
| 13550 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13551 | .dac_nids = alc268_dac_nids, |
| 13552 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13553 | .adc_nids = alc268_adc_nids_alt, |
| 13554 | .hp_nid = 0x03, |
| 13555 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13556 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13557 | .unsol_event = alc_sku_unsol_event, |
| 13558 | .setup = alc267_quanta_il1_setup, |
| 13559 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13560 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13561 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13562 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13563 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13564 | .init_verbs = { alc268_base_init_verbs }, |
| 13565 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13566 | .dac_nids = alc268_dac_nids, |
| 13567 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13568 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13569 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13570 | .hp_nid = 0x03, |
| 13571 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13572 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13573 | .channel_mode = alc268_modes, |
| 13574 | .input_mux = &alc268_capture_source, |
| 13575 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13576 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13577 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13578 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13579 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13580 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13581 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13582 | .dac_nids = alc268_dac_nids, |
| 13583 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13584 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13585 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13586 | .hp_nid = 0x03, |
| 13587 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13588 | .channel_mode = alc268_modes, |
| 13589 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13590 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13591 | .setup = alc268_toshiba_setup, |
| 13592 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13593 | }, |
| 13594 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13595 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13596 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13597 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13598 | alc268_acer_verbs }, |
| 13599 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13600 | .dac_nids = alc268_dac_nids, |
| 13601 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13602 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13603 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13604 | .hp_nid = 0x02, |
| 13605 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13606 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13607 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13608 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13609 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13610 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13611 | [ALC268_ACER_DMIC] = { |
| 13612 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13613 | alc268_beep_mixer }, |
| 13614 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13615 | alc268_acer_verbs }, |
| 13616 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13617 | .dac_nids = alc268_dac_nids, |
| 13618 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13619 | .adc_nids = alc268_adc_nids_alt, |
| 13620 | .capsrc_nids = alc268_capsrc_nids, |
| 13621 | .hp_nid = 0x02, |
| 13622 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13623 | .channel_mode = alc268_modes, |
| 13624 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13625 | .unsol_event = alc268_acer_unsol_event, |
| 13626 | .init_hook = alc268_acer_init_hook, |
| 13627 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13628 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13629 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13630 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13631 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13632 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13633 | alc268_acer_aspire_one_verbs }, |
| 13634 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13635 | .dac_nids = alc268_dac_nids, |
| 13636 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13637 | .adc_nids = alc268_adc_nids_alt, |
| 13638 | .capsrc_nids = alc268_capsrc_nids, |
| 13639 | .hp_nid = 0x03, |
| 13640 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13641 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13642 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13643 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13644 | .init_hook = alc268_acer_lc_init_hook, |
| 13645 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13646 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13647 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13648 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13649 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13650 | alc268_dell_verbs }, |
| 13651 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13652 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13653 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13654 | .adc_nids = alc268_adc_nids_alt, |
| 13655 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13656 | .hp_nid = 0x02, |
| 13657 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13658 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13659 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13660 | .setup = alc268_dell_setup, |
| 13661 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13662 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13663 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13664 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13665 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13666 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13667 | alc268_toshiba_verbs }, |
| 13668 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13669 | .dac_nids = alc268_dac_nids, |
| 13670 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13671 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13672 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13673 | .hp_nid = 0x03, |
| 13674 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13675 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13676 | .channel_mode = alc268_modes, |
| 13677 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13678 | .setup = alc268_toshiba_setup, |
| 13679 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13680 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13681 | #ifdef CONFIG_SND_DEBUG |
| 13682 | [ALC268_TEST] = { |
| 13683 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13684 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13685 | alc268_volume_init_verbs }, |
| 13686 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13687 | .dac_nids = alc268_dac_nids, |
| 13688 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13689 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13690 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13691 | .hp_nid = 0x03, |
| 13692 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13693 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13694 | .channel_mode = alc268_modes, |
| 13695 | .input_mux = &alc268_capture_source, |
| 13696 | }, |
| 13697 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13698 | }; |
| 13699 | |
| 13700 | static int patch_alc268(struct hda_codec *codec) |
| 13701 | { |
| 13702 | struct alc_spec *spec; |
| 13703 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13704 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13705 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13706 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13707 | if (spec == NULL) |
| 13708 | return -ENOMEM; |
| 13709 | |
| 13710 | codec->spec = spec; |
| 13711 | |
| 13712 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13713 | alc268_models, |
| 13714 | alc268_cfg_tbl); |
| 13715 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13716 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13717 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13718 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13719 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13720 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13721 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13722 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13723 | board_config = ALC268_AUTO; |
| 13724 | } |
| 13725 | |
| 13726 | if (board_config == ALC268_AUTO) { |
| 13727 | /* automatic parse from the BIOS config */ |
| 13728 | err = alc268_parse_auto_config(codec); |
| 13729 | if (err < 0) { |
| 13730 | alc_free(codec); |
| 13731 | return err; |
| 13732 | } else if (!err) { |
| 13733 | printk(KERN_INFO |
| 13734 | "hda_codec: Cannot set up configuration " |
| 13735 | "from BIOS. Using base mode...\n"); |
| 13736 | board_config = ALC268_3ST; |
| 13737 | } |
| 13738 | } |
| 13739 | |
| 13740 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13741 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13742 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13743 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 13744 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13745 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13746 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13747 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 13748 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13749 | has_beep = 0; |
| 13750 | for (i = 0; i < spec->num_mixers; i++) { |
| 13751 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 13752 | has_beep = 1; |
| 13753 | break; |
| 13754 | } |
| 13755 | } |
| 13756 | |
| 13757 | if (has_beep) { |
| 13758 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13759 | if (err < 0) { |
| 13760 | alc_free(codec); |
| 13761 | return err; |
| 13762 | } |
| 13763 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 13764 | /* override the amp caps for beep generator */ |
| 13765 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13766 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 13767 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 13768 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 13769 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13770 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13771 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13772 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13773 | /* check whether NID 0x07 is valid */ |
| 13774 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13775 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13776 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13777 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13778 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13779 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13780 | if (spec->auto_mic || |
| 13781 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13782 | spec->adc_nids = alc268_adc_nids_alt; |
| 13783 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13784 | if (spec->auto_mic) |
| 13785 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13786 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 13787 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 13788 | else |
| 13789 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13790 | } else { |
| 13791 | spec->adc_nids = alc268_adc_nids; |
| 13792 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13793 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13794 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13795 | /* set default input source */ |
| 13796 | for (i = 0; i < spec->num_adc_nids; i++) |
| 13797 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 13798 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13799 | i < spec->num_mux_defs ? |
| 13800 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13801 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13802 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13803 | |
| 13804 | spec->vmaster_nid = 0x02; |
| 13805 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13806 | codec->patch_ops = alc_patch_ops; |
| 13807 | if (board_config == ALC268_AUTO) |
| 13808 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13809 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13810 | return 0; |
| 13811 | } |
| 13812 | |
| 13813 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13814 | * ALC269 channel source setting (2 channel) |
| 13815 | */ |
| 13816 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 13817 | |
| 13818 | #define alc269_dac_nids alc260_dac_nids |
| 13819 | |
| 13820 | static hda_nid_t alc269_adc_nids[1] = { |
| 13821 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13822 | 0x08, |
| 13823 | }; |
| 13824 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13825 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 13826 | 0x23, |
| 13827 | }; |
| 13828 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13829 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 13830 | /* ADC1 */ |
| 13831 | 0x09, |
| 13832 | }; |
| 13833 | |
| 13834 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 13835 | 0x22, |
| 13836 | }; |
| 13837 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 13838 | static hda_nid_t alc269_adc_candidates[] = { |
| 13839 | 0x08, 0x09, 0x07, |
| 13840 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13841 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13842 | #define alc269_modes alc260_modes |
| 13843 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 13844 | |
| 13845 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 13846 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13847 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13848 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13849 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13850 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13851 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13852 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13853 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13854 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13855 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13856 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13857 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 13858 | { } /* end */ |
| 13859 | }; |
| 13860 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13861 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 13862 | /* output mixer control */ |
| 13863 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13864 | { |
| 13865 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13866 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13867 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13868 | .info = snd_hda_mixer_amp_switch_info, |
| 13869 | .get = snd_hda_mixer_amp_switch_get, |
| 13870 | .put = alc268_acer_master_sw_put, |
| 13871 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13872 | }, |
| 13873 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13874 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13875 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13876 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13877 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13878 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13879 | { } |
| 13880 | }; |
| 13881 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13882 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 13883 | /* output mixer control */ |
| 13884 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13885 | { |
| 13886 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13887 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13888 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13889 | .info = snd_hda_mixer_amp_switch_info, |
| 13890 | .get = snd_hda_mixer_amp_switch_get, |
| 13891 | .put = alc268_acer_master_sw_put, |
| 13892 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13893 | }, |
| 13894 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13895 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13896 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13897 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13898 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13899 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13900 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 13901 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 13902 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13903 | { } |
| 13904 | }; |
| 13905 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13906 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13907 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13908 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13909 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13910 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13911 | { } /* end */ |
| 13912 | }; |
| 13913 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13914 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 13915 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13916 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13917 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13918 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13919 | { } /* end */ |
| 13920 | }; |
| 13921 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 13922 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
| 13923 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13924 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 13925 | { } /* end */ |
| 13926 | }; |
| 13927 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13928 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13929 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 13930 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13931 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 13932 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13933 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13934 | { } /* end */ |
| 13935 | }; |
| 13936 | |
| 13937 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13938 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13939 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13940 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13941 | { } /* end */ |
| 13942 | }; |
| 13943 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13944 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 13945 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13946 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13947 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13948 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13949 | { } /* end */ |
| 13950 | }; |
| 13951 | |
| 13952 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 13953 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13954 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13955 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13956 | { } /* end */ |
| 13957 | }; |
| 13958 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13959 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13960 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13961 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13962 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 13963 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13964 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13965 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13966 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13967 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13968 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13969 | { } |
| 13970 | }; |
| 13971 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13972 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 13973 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13974 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13975 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13976 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13977 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13978 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13979 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13980 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13981 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13982 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13983 | { } |
| 13984 | }; |
| 13985 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13986 | /* toggle speaker-output according to the hp-jack state */ |
| 13987 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 13988 | { |
| 13989 | unsigned int present; |
| 13990 | unsigned char bits; |
| 13991 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13992 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13993 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13994 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13995 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13996 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13997 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13998 | |
| 13999 | snd_hda_codec_write(codec, 0x20, 0, |
| 14000 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14001 | snd_hda_codec_write(codec, 0x20, 0, |
| 14002 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14003 | |
| 14004 | snd_hda_codec_write(codec, 0x20, 0, |
| 14005 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14006 | snd_hda_codec_write(codec, 0x20, 0, |
| 14007 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14008 | } |
| 14009 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14010 | /* toggle speaker-output according to the hp-jacks state */ |
| 14011 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 14012 | { |
| 14013 | unsigned int present; |
| 14014 | unsigned char bits; |
| 14015 | |
| 14016 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14017 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14018 | |
| 14019 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14020 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14021 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14022 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14023 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14024 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14025 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14026 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14027 | |
| 14028 | snd_hda_codec_write(codec, 0x20, 0, |
| 14029 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14030 | snd_hda_codec_write(codec, 0x20, 0, |
| 14031 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14032 | |
| 14033 | snd_hda_codec_write(codec, 0x20, 0, |
| 14034 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14035 | snd_hda_codec_write(codec, 0x20, 0, |
| 14036 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14037 | } |
| 14038 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14039 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14040 | { |
| 14041 | unsigned int present_laptop; |
| 14042 | unsigned int present_dock; |
| 14043 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14044 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14045 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14046 | |
| 14047 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14048 | if (present_dock) |
| 14049 | snd_hda_codec_write(codec, 0x23, 0, |
| 14050 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14051 | if (present_laptop) |
| 14052 | snd_hda_codec_write(codec, 0x23, 0, |
| 14053 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14054 | if (!present_dock && !present_laptop) |
| 14055 | snd_hda_codec_write(codec, 0x23, 0, |
| 14056 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14057 | } |
| 14058 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14059 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14060 | unsigned int res) |
| 14061 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14062 | switch (res >> 26) { |
| 14063 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14064 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14065 | break; |
| 14066 | case ALC880_MIC_EVENT: |
| 14067 | alc_mic_automute(codec); |
| 14068 | break; |
| 14069 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14070 | } |
| 14071 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14072 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14073 | unsigned int res) |
| 14074 | { |
| 14075 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14076 | alc269_lifebook_speaker_automute(codec); |
| 14077 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14078 | alc269_lifebook_mic_autoswitch(codec); |
| 14079 | } |
| 14080 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14081 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14082 | { |
| 14083 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14084 | spec->autocfg.hp_pins[0] = 0x15; |
| 14085 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14086 | spec->ext_mic.pin = 0x18; |
| 14087 | spec->ext_mic.mux_idx = 0; |
| 14088 | spec->int_mic.pin = 0x19; |
| 14089 | spec->int_mic.mux_idx = 1; |
| 14090 | spec->auto_mic = 1; |
| 14091 | } |
| 14092 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14093 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14094 | { |
| 14095 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14096 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14097 | } |
| 14098 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14099 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14100 | { |
| 14101 | alc269_lifebook_speaker_automute(codec); |
| 14102 | alc269_lifebook_mic_autoswitch(codec); |
| 14103 | } |
| 14104 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14105 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14106 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14107 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14108 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14109 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14110 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14111 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14112 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14113 | {} |
| 14114 | }; |
| 14115 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14116 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14117 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14118 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14119 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14120 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14121 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14122 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14123 | {} |
| 14124 | }; |
| 14125 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14126 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 14127 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14128 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14129 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14130 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14131 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14132 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14133 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14134 | {} |
| 14135 | }; |
| 14136 | |
| 14137 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14138 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14139 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14140 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14141 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14142 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14143 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14144 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14145 | {} |
| 14146 | }; |
| 14147 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14148 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
| 14149 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14150 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14151 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14152 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14153 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14154 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14155 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14156 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14157 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14158 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14159 | { } |
| 14160 | }; |
| 14161 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14162 | /* toggle speaker-output according to the hp-jack state */ |
| 14163 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 14164 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14165 | struct alc_spec *spec = codec->spec; |
| 14166 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14167 | unsigned int present; |
| 14168 | unsigned char bits; |
| 14169 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14170 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14171 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14172 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14173 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14174 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14175 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14176 | } |
| 14177 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14178 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14179 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14180 | unsigned int res) |
| 14181 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14182 | switch (res >> 26) { |
| 14183 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14184 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14185 | break; |
| 14186 | case ALC880_MIC_EVENT: |
| 14187 | alc_mic_automute(codec); |
| 14188 | break; |
| 14189 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14190 | } |
| 14191 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14192 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14193 | { |
| 14194 | struct alc_spec *spec = codec->spec; |
| 14195 | spec->autocfg.hp_pins[0] = 0x15; |
| 14196 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14197 | spec->ext_mic.pin = 0x18; |
| 14198 | spec->ext_mic.mux_idx = 0; |
| 14199 | spec->int_mic.pin = 0x19; |
| 14200 | spec->int_mic.mux_idx = 1; |
| 14201 | spec->auto_mic = 1; |
| 14202 | } |
| 14203 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14204 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14205 | { |
| 14206 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14207 | spec->autocfg.hp_pins[0] = 0x15; |
| 14208 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14209 | spec->ext_mic.pin = 0x18; |
| 14210 | spec->ext_mic.mux_idx = 0; |
| 14211 | spec->int_mic.pin = 0x12; |
| 14212 | spec->int_mic.mux_idx = 5; |
| 14213 | spec->auto_mic = 1; |
| 14214 | } |
| 14215 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14216 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14217 | { |
| 14218 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14219 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14220 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14221 | spec->ext_mic.pin = 0x18; |
| 14222 | spec->ext_mic.mux_idx = 0; |
| 14223 | spec->int_mic.pin = 0x19; |
| 14224 | spec->int_mic.mux_idx = 1; |
| 14225 | spec->auto_mic = 1; |
| 14226 | } |
| 14227 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14228 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14229 | { |
| 14230 | struct alc_spec *spec = codec->spec; |
| 14231 | spec->autocfg.hp_pins[0] = 0x21; |
| 14232 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14233 | spec->ext_mic.pin = 0x18; |
| 14234 | spec->ext_mic.mux_idx = 0; |
| 14235 | spec->int_mic.pin = 0x12; |
| 14236 | spec->int_mic.mux_idx = 6; |
| 14237 | spec->auto_mic = 1; |
| 14238 | } |
| 14239 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14240 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14241 | { |
| 14242 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14243 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14244 | } |
| 14245 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14246 | /* |
| 14247 | * generic initialization of ADC, input mixers and output mixers |
| 14248 | */ |
| 14249 | static struct hda_verb alc269_init_verbs[] = { |
| 14250 | /* |
| 14251 | * Unmute ADC0 and set the default input to mic-in |
| 14252 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14253 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14254 | |
| 14255 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14256 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14257 | */ |
| 14258 | /* set vol=0 to output mixers */ |
| 14259 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14260 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14261 | |
| 14262 | /* set up input amps for analog loopback */ |
| 14263 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14264 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14265 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14266 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14267 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14268 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14269 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14270 | |
| 14271 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14272 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14273 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14274 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14275 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14276 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14277 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14278 | |
| 14279 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14280 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14281 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14282 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14283 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14284 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14285 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14286 | |
| 14287 | /* set EAPD */ |
| 14288 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14289 | { } |
| 14290 | }; |
| 14291 | |
| 14292 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14293 | /* |
| 14294 | * Unmute ADC0 and set the default input to mic-in |
| 14295 | */ |
| 14296 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14297 | |
| 14298 | /* |
| 14299 | * Set up output mixers (0x02 - 0x03) |
| 14300 | */ |
| 14301 | /* set vol=0 to output mixers */ |
| 14302 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14303 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14304 | |
| 14305 | /* set up input amps for analog loopback */ |
| 14306 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14307 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14308 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14309 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14310 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14311 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14312 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14313 | |
| 14314 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14315 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14316 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14317 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14318 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14319 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14320 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14321 | |
| 14322 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14323 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14324 | |
| 14325 | /* FIXME: use Mux-type input source selection */ |
| 14326 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14327 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14328 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14329 | |
| 14330 | /* set EAPD */ |
| 14331 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14332 | { } |
| 14333 | }; |
| 14334 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14335 | #define alc269_auto_create_multi_out_ctls \ |
| 14336 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14337 | #define alc269_auto_create_input_ctls \ |
| 14338 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14339 | |
| 14340 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14341 | #define alc269_loopbacks alc880_loopbacks |
| 14342 | #endif |
| 14343 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14344 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14345 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14346 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14347 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14348 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14349 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14350 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14351 | .substreams = 1, |
| 14352 | .channels_min = 2, |
| 14353 | .channels_max = 8, |
| 14354 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14355 | /* NID is set in alc_build_pcms */ |
| 14356 | .ops = { |
| 14357 | .open = alc880_playback_pcm_open, |
| 14358 | .prepare = alc880_playback_pcm_prepare, |
| 14359 | .cleanup = alc880_playback_pcm_cleanup |
| 14360 | }, |
| 14361 | }; |
| 14362 | |
| 14363 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14364 | .substreams = 1, |
| 14365 | .channels_min = 2, |
| 14366 | .channels_max = 2, |
| 14367 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14368 | /* NID is set in alc_build_pcms */ |
| 14369 | }; |
| 14370 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14371 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14372 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14373 | { |
| 14374 | switch (codec->subsystem_id) { |
| 14375 | case 0x103c1586: |
| 14376 | return 1; |
| 14377 | } |
| 14378 | return 0; |
| 14379 | } |
| 14380 | |
| 14381 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14382 | { |
| 14383 | /* update mute-LED according to the speaker mute state */ |
| 14384 | if (nid == 0x01 || nid == 0x14) { |
| 14385 | int pinval; |
| 14386 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14387 | HDA_AMP_MUTE) |
| 14388 | pinval = 0x24; |
| 14389 | else |
| 14390 | pinval = 0x20; |
| 14391 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a5 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14392 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14393 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14394 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14395 | } |
| 14396 | return alc_check_power_status(codec, nid); |
| 14397 | } |
| 14398 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14399 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14400 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14401 | { |
| 14402 | struct alc_spec *spec = codec->spec; |
| 14403 | |
| 14404 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14405 | return 0; |
| 14406 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14407 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14408 | if (spec->ext_mic.pin <= 0x12) { |
| 14409 | spec->private_adc_nids[0] = 0x08; |
| 14410 | spec->private_adc_nids[1] = 0x11; |
| 14411 | spec->private_capsrc_nids[0] = 0x23; |
| 14412 | spec->private_capsrc_nids[1] = 0x22; |
| 14413 | } else { |
| 14414 | spec->private_adc_nids[0] = 0x11; |
| 14415 | spec->private_adc_nids[1] = 0x08; |
| 14416 | spec->private_capsrc_nids[0] = 0x22; |
| 14417 | spec->private_capsrc_nids[1] = 0x23; |
| 14418 | } |
| 14419 | spec->adc_nids = spec->private_adc_nids; |
| 14420 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14421 | spec->num_adc_nids = 2; |
| 14422 | spec->dual_adc_switch = 1; |
| 14423 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14424 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14425 | return 1; |
| 14426 | } |
| 14427 | return 0; |
| 14428 | } |
| 14429 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14430 | /* |
| 14431 | * BIOS auto configuration |
| 14432 | */ |
| 14433 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14434 | { |
| 14435 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14436 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14437 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14438 | |
| 14439 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14440 | alc269_ignore); |
| 14441 | if (err < 0) |
| 14442 | return err; |
| 14443 | |
| 14444 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14445 | if (err < 0) |
| 14446 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14447 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14448 | if (err < 0) |
| 14449 | return err; |
| 14450 | |
| 14451 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14452 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14453 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14454 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14455 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14456 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14457 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14458 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { |
| 14459 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14460 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14461 | } else { |
| 14462 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14463 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14464 | } |
| 14465 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14466 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14467 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14468 | |
| 14469 | if (!alc275_setup_dual_adc(codec)) |
| 14470 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14471 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14472 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14473 | /* set default input source */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14474 | if (!spec->dual_adc_switch) |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 14475 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], |
| 14476 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14477 | |
| 14478 | err = alc_auto_add_mic_boost(codec); |
| 14479 | if (err < 0) |
| 14480 | return err; |
| 14481 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14482 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14483 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14484 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14485 | return 1; |
| 14486 | } |
| 14487 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14488 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14489 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14490 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14491 | |
| 14492 | |
| 14493 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14494 | static void alc269_auto_init(struct hda_codec *codec) |
| 14495 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14496 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14497 | alc269_auto_init_multi_out(codec); |
| 14498 | alc269_auto_init_hp_out(codec); |
| 14499 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14500 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14501 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14502 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14503 | } |
| 14504 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14505 | enum { |
| 14506 | ALC269_FIXUP_SONY_VAIO, |
| 14507 | }; |
| 14508 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14509 | static const struct alc_fixup alc269_fixups[] = { |
| 14510 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14511 | .verbs = (const struct hda_verb[]) { |
| 14512 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14513 | {} |
| 14514 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14515 | }, |
| 14516 | }; |
| 14517 | |
| 14518 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
| 14519 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | dbbcbc0 | 2010-08-23 08:14:35 +0200 | [diff] [blame] | 14520 | SND_PCI_QUIRK(0x104d, 0x9077, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14521 | {} |
| 14522 | }; |
| 14523 | |
| 14524 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14525 | /* |
| 14526 | * configuration and preset |
| 14527 | */ |
| 14528 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14529 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14530 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14531 | [ALC269_AMIC] = "laptop-amic", |
| 14532 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14533 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14534 | [ALC269_LIFEBOOK] = "lifebook", |
| 14535 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14536 | }; |
| 14537 | |
| 14538 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14539 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14540 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14541 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14542 | ALC269_AMIC), |
| 14543 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14544 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14545 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14546 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14547 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14548 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14549 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14550 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14551 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 14552 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 14553 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14554 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14555 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14556 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14557 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14558 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14559 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14560 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14561 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14562 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14563 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14564 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14565 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14566 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14567 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14568 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14569 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14570 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14571 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14572 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14573 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14574 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14575 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14576 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14577 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14578 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14579 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14580 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14581 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14582 | ALC269_DMIC), |
| 14583 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14584 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14585 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14586 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14587 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14588 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14589 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14590 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14591 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14592 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14593 | {} |
| 14594 | }; |
| 14595 | |
| 14596 | static struct alc_config_preset alc269_presets[] = { |
| 14597 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14598 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14599 | .init_verbs = { alc269_init_verbs }, |
| 14600 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14601 | .dac_nids = alc269_dac_nids, |
| 14602 | .hp_nid = 0x03, |
| 14603 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14604 | .channel_mode = alc269_modes, |
| 14605 | .input_mux = &alc269_capture_source, |
| 14606 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14607 | [ALC269_QUANTA_FL1] = { |
| 14608 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14609 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14610 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14611 | .dac_nids = alc269_dac_nids, |
| 14612 | .hp_nid = 0x03, |
| 14613 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14614 | .channel_mode = alc269_modes, |
| 14615 | .input_mux = &alc269_capture_source, |
| 14616 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14617 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14618 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14619 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14620 | [ALC269_AMIC] = { |
| 14621 | .mixers = { alc269_laptop_mixer }, |
| 14622 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14623 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14624 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14625 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14626 | .dac_nids = alc269_dac_nids, |
| 14627 | .hp_nid = 0x03, |
| 14628 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14629 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14630 | .unsol_event = alc269_laptop_unsol_event, |
| 14631 | .setup = alc269_laptop_amic_setup, |
| 14632 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14633 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14634 | [ALC269_DMIC] = { |
| 14635 | .mixers = { alc269_laptop_mixer }, |
| 14636 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14637 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14638 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14639 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14640 | .dac_nids = alc269_dac_nids, |
| 14641 | .hp_nid = 0x03, |
| 14642 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14643 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14644 | .unsol_event = alc269_laptop_unsol_event, |
| 14645 | .setup = alc269_laptop_dmic_setup, |
| 14646 | .init_hook = alc269_laptop_inithook, |
| 14647 | }, |
| 14648 | [ALC269VB_AMIC] = { |
| 14649 | .mixers = { alc269vb_laptop_mixer }, |
| 14650 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 14651 | .init_verbs = { alc269vb_init_verbs, |
| 14652 | alc269vb_laptop_amic_init_verbs }, |
| 14653 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14654 | .dac_nids = alc269_dac_nids, |
| 14655 | .hp_nid = 0x03, |
| 14656 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14657 | .channel_mode = alc269_modes, |
| 14658 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14659 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14660 | .init_hook = alc269_laptop_inithook, |
| 14661 | }, |
| 14662 | [ALC269VB_DMIC] = { |
| 14663 | .mixers = { alc269vb_laptop_mixer }, |
| 14664 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14665 | .init_verbs = { alc269vb_init_verbs, |
| 14666 | alc269vb_laptop_dmic_init_verbs }, |
| 14667 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14668 | .dac_nids = alc269_dac_nids, |
| 14669 | .hp_nid = 0x03, |
| 14670 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14671 | .channel_mode = alc269_modes, |
| 14672 | .unsol_event = alc269_laptop_unsol_event, |
| 14673 | .setup = alc269vb_laptop_dmic_setup, |
| 14674 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14675 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14676 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14677 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14678 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14679 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14680 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14681 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14682 | .dac_nids = alc269_dac_nids, |
| 14683 | .hp_nid = 0x03, |
| 14684 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14685 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14686 | .unsol_event = alc269_laptop_unsol_event, |
| 14687 | .setup = alc269_laptop_dmic_setup, |
| 14688 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14689 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14690 | [ALC269_LIFEBOOK] = { |
| 14691 | .mixers = { alc269_lifebook_mixer }, |
| 14692 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 14693 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14694 | .dac_nids = alc269_dac_nids, |
| 14695 | .hp_nid = 0x03, |
| 14696 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14697 | .channel_mode = alc269_modes, |
| 14698 | .input_mux = &alc269_capture_source, |
| 14699 | .unsol_event = alc269_lifebook_unsol_event, |
| 14700 | .init_hook = alc269_lifebook_init_hook, |
| 14701 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14702 | [ALC271_ACER] = { |
| 14703 | .mixers = { alc269_asus_mixer }, |
| 14704 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14705 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 14706 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14707 | .dac_nids = alc269_dac_nids, |
| 14708 | .adc_nids = alc262_dmic_adc_nids, |
| 14709 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 14710 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 14711 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14712 | .channel_mode = alc269_modes, |
| 14713 | .input_mux = &alc269_capture_source, |
| 14714 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 14715 | .unsol_event = alc_sku_unsol_event, |
| 14716 | .setup = alc269vb_laptop_dmic_setup, |
| 14717 | .init_hook = alc_inithook, |
| 14718 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14719 | }; |
| 14720 | |
| 14721 | static int patch_alc269(struct hda_codec *codec) |
| 14722 | { |
| 14723 | struct alc_spec *spec; |
| 14724 | int board_config; |
| 14725 | int err; |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14726 | int is_alc269vb = 0; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14727 | |
| 14728 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14729 | if (spec == NULL) |
| 14730 | return -ENOMEM; |
| 14731 | |
| 14732 | codec->spec = spec; |
| 14733 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14734 | alc_auto_parse_customize_define(codec); |
| 14735 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14736 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14737 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 14738 | spec->cdefine.platform_type == 1) |
| 14739 | alc_codec_rename(codec, "ALC271X"); |
| 14740 | else |
| 14741 | alc_codec_rename(codec, "ALC259"); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14742 | is_alc269vb = 1; |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14743 | } else |
| 14744 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14745 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14746 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 14747 | alc269_models, |
| 14748 | alc269_cfg_tbl); |
| 14749 | |
| 14750 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14751 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14752 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14753 | board_config = ALC269_AUTO; |
| 14754 | } |
| 14755 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14756 | if (board_config == ALC269_AUTO) |
| 14757 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); |
| 14758 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14759 | if (board_config == ALC269_AUTO) { |
| 14760 | /* automatic parse from the BIOS config */ |
| 14761 | err = alc269_parse_auto_config(codec); |
| 14762 | if (err < 0) { |
| 14763 | alc_free(codec); |
| 14764 | return err; |
| 14765 | } else if (!err) { |
| 14766 | printk(KERN_INFO |
| 14767 | "hda_codec: Cannot set up configuration " |
| 14768 | "from BIOS. Using base mode...\n"); |
| 14769 | board_config = ALC269_BASIC; |
| 14770 | } |
| 14771 | } |
| 14772 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 14773 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 14774 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14775 | if (err < 0) { |
| 14776 | alc_free(codec); |
| 14777 | return err; |
| 14778 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14779 | } |
| 14780 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14781 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14782 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14783 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14784 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14785 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 14786 | * fix the sample rate of analog I/O to 44.1kHz |
| 14787 | */ |
| 14788 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 14789 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14790 | } else if (spec->dual_adc_switch) { |
| 14791 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14792 | /* switch ADC dynamically */ |
| 14793 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14794 | } else { |
| 14795 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14796 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 14797 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14798 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 14799 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 14800 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14801 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
| 14802 | if (!is_alc269vb) { |
| 14803 | spec->adc_nids = alc269_adc_nids; |
| 14804 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 14805 | spec->capsrc_nids = alc269_capsrc_nids; |
| 14806 | } else { |
| 14807 | spec->adc_nids = alc269vb_adc_nids; |
| 14808 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 14809 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 14810 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14811 | } |
| 14812 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14813 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14814 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 14815 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14816 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14817 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14818 | if (board_config == ALC269_AUTO) |
| 14819 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); |
| 14820 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 14821 | spec->vmaster_nid = 0x02; |
| 14822 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14823 | codec->patch_ops = alc_patch_ops; |
| 14824 | if (board_config == ALC269_AUTO) |
| 14825 | spec->init_hook = alc269_auto_init; |
| 14826 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14827 | if (!spec->loopback.amplist) |
| 14828 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14829 | if (alc269_mic2_for_mute_led(codec)) |
| 14830 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14831 | #endif |
| 14832 | |
| 14833 | return 0; |
| 14834 | } |
| 14835 | |
| 14836 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14837 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 14838 | */ |
| 14839 | |
| 14840 | /* |
| 14841 | * set the path ways for 2 channel output |
| 14842 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 14843 | */ |
| 14844 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 14845 | /* set pin widget 1Ah (line in) for input */ |
| 14846 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14847 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14848 | * the vref |
| 14849 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14850 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14851 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14852 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14853 | #if 0 |
| 14854 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14855 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14856 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14857 | { } /* end */ |
| 14858 | }; |
| 14859 | /* |
| 14860 | * 6ch mode |
| 14861 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 14862 | */ |
| 14863 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 14864 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14865 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14866 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14867 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14868 | |
| 14869 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14870 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14871 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14872 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14873 | #if 0 |
| 14874 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14875 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14876 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14877 | { } /* end */ |
| 14878 | }; |
| 14879 | |
| 14880 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 14881 | { 2, alc861_threestack_ch2_init }, |
| 14882 | { 6, alc861_threestack_ch6_init }, |
| 14883 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14884 | /* Set mic1 as input and unmute the mixer */ |
| 14885 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 14886 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14887 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14888 | { } /* end */ |
| 14889 | }; |
| 14890 | /* Set mic1 as output and mute mixer */ |
| 14891 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 14892 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14893 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14894 | { } /* end */ |
| 14895 | }; |
| 14896 | |
| 14897 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 14898 | { 2, alc861_uniwill_m31_ch2_init }, |
| 14899 | { 4, alc861_uniwill_m31_ch4_init }, |
| 14900 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14901 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14902 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 14903 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 14904 | /* set pin widget 1Ah (line in) for input */ |
| 14905 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14906 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14907 | * the vref |
| 14908 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14909 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14910 | |
| 14911 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14912 | #if 0 |
| 14913 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14914 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14915 | #endif |
| 14916 | { } /* end */ |
| 14917 | }; |
| 14918 | /* Set mic1 nad line-in as output and mute mixer */ |
| 14919 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 14920 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14921 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14922 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14923 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14924 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14925 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14926 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14927 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14928 | |
| 14929 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14930 | #if 0 |
| 14931 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14932 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14933 | #endif |
| 14934 | { } /* end */ |
| 14935 | }; |
| 14936 | |
| 14937 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 14938 | { 2, alc861_asus_ch2_init }, |
| 14939 | { 6, alc861_asus_ch6_init }, |
| 14940 | }; |
| 14941 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14942 | /* patch-ALC861 */ |
| 14943 | |
| 14944 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 14945 | /* output mixer control */ |
| 14946 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14947 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14948 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14949 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14950 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14951 | |
| 14952 | /*Input mixer control */ |
| 14953 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14954 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14955 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14956 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14957 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14958 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14959 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14960 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14961 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14962 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14963 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14964 | { } /* end */ |
| 14965 | }; |
| 14966 | |
| 14967 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 14968 | /* output mixer control */ |
| 14969 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14970 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14971 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14972 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14973 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14974 | |
| 14975 | /* Input mixer control */ |
| 14976 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14977 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14978 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14979 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14980 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14981 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14982 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14983 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14984 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14985 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14986 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14987 | { |
| 14988 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14989 | .name = "Channel Mode", |
| 14990 | .info = alc_ch_mode_info, |
| 14991 | .get = alc_ch_mode_get, |
| 14992 | .put = alc_ch_mode_put, |
| 14993 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 14994 | }, |
| 14995 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14996 | }; |
| 14997 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14998 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14999 | /* output mixer control */ |
| 15000 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15001 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15002 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15003 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15004 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15005 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15006 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15007 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 15008 | /* output mixer control */ |
| 15009 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15010 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15011 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15012 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15013 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15014 | |
| 15015 | /* Input mixer control */ |
| 15016 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15017 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15018 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15019 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15020 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15021 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15022 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15023 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15024 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15025 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15026 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15027 | { |
| 15028 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15029 | .name = "Channel Mode", |
| 15030 | .info = alc_ch_mode_info, |
| 15031 | .get = alc_ch_mode_get, |
| 15032 | .put = alc_ch_mode_put, |
| 15033 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15034 | }, |
| 15035 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15036 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15037 | |
| 15038 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 15039 | /* output mixer control */ |
| 15040 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15041 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15042 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15043 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15044 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15045 | |
| 15046 | /* Input mixer control */ |
| 15047 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15048 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15049 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15050 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15051 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15052 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15053 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15054 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15055 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15056 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15057 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15058 | { |
| 15059 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15060 | .name = "Channel Mode", |
| 15061 | .info = alc_ch_mode_info, |
| 15062 | .get = alc_ch_mode_get, |
| 15063 | .put = alc_ch_mode_put, |
| 15064 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15065 | }, |
| 15066 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15067 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15068 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15069 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15070 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15071 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15072 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15073 | { } |
| 15074 | }; |
| 15075 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15076 | /* |
| 15077 | * generic initialization of ADC, input mixers and output mixers |
| 15078 | */ |
| 15079 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15080 | /* |
| 15081 | * Unmute ADC0 and set the default input to mic-in |
| 15082 | */ |
| 15083 | /* port-A for surround (rear panel) */ |
| 15084 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15085 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15086 | /* port-B for mic-in (rear panel) with vref */ |
| 15087 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15088 | /* port-C for line-in (rear panel) */ |
| 15089 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15090 | /* port-D for Front */ |
| 15091 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15092 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15093 | /* port-E for HP out (front panel) */ |
| 15094 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15095 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15096 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15097 | /* port-F for mic-in (front panel) with vref */ |
| 15098 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15099 | /* port-G for CLFE (rear panel) */ |
| 15100 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15101 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15102 | /* port-H for side (rear panel) */ |
| 15103 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15104 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15105 | /* CD-in */ |
| 15106 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15107 | /* route front mic to ADC1*/ |
| 15108 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15109 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15110 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15111 | /* Unmute DAC0~3 & spdif out*/ |
| 15112 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15113 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15114 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15115 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15116 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15117 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15118 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15119 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15120 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15121 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15122 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15123 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15124 | /* Unmute Stereo Mixer 15 */ |
| 15125 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15126 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15127 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15128 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15129 | |
| 15130 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15131 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15132 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15133 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15134 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15135 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15136 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15137 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15138 | /* hp used DAC 3 (Front) */ |
| 15139 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15140 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15141 | |
| 15142 | { } |
| 15143 | }; |
| 15144 | |
| 15145 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15146 | /* |
| 15147 | * Unmute ADC0 and set the default input to mic-in |
| 15148 | */ |
| 15149 | /* port-A for surround (rear panel) */ |
| 15150 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15151 | /* port-B for mic-in (rear panel) with vref */ |
| 15152 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15153 | /* port-C for line-in (rear panel) */ |
| 15154 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15155 | /* port-D for Front */ |
| 15156 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15157 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15158 | /* port-E for HP out (front panel) */ |
| 15159 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15160 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15161 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15162 | /* port-F for mic-in (front panel) with vref */ |
| 15163 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15164 | /* port-G for CLFE (rear panel) */ |
| 15165 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15166 | /* port-H for side (rear panel) */ |
| 15167 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15168 | /* CD-in */ |
| 15169 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15170 | /* route front mic to ADC1*/ |
| 15171 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15172 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15173 | /* Unmute DAC0~3 & spdif out*/ |
| 15174 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15175 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15176 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15177 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15178 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15179 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15180 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15181 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15182 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15183 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15184 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15185 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15186 | /* Unmute Stereo Mixer 15 */ |
| 15187 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15188 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15189 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15190 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15191 | |
| 15192 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15193 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15194 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15195 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15196 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15197 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15198 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15199 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15200 | /* hp used DAC 3 (Front) */ |
| 15201 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15202 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15203 | { } |
| 15204 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15205 | |
| 15206 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15207 | /* |
| 15208 | * Unmute ADC0 and set the default input to mic-in |
| 15209 | */ |
| 15210 | /* port-A for surround (rear panel) */ |
| 15211 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15212 | /* port-B for mic-in (rear panel) with vref */ |
| 15213 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15214 | /* port-C for line-in (rear panel) */ |
| 15215 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15216 | /* port-D for Front */ |
| 15217 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15218 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15219 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15220 | /* this has to be set to VREF80 */ |
| 15221 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15222 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15223 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15224 | /* port-F for mic-in (front panel) with vref */ |
| 15225 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15226 | /* port-G for CLFE (rear panel) */ |
| 15227 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15228 | /* port-H for side (rear panel) */ |
| 15229 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15230 | /* CD-in */ |
| 15231 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15232 | /* route front mic to ADC1*/ |
| 15233 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15234 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15235 | /* Unmute DAC0~3 & spdif out*/ |
| 15236 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15237 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15238 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15239 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15240 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15241 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15242 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15243 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15244 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15245 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15246 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15247 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15248 | /* Unmute Stereo Mixer 15 */ |
| 15249 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15250 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15251 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15252 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15253 | |
| 15254 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15255 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15256 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15257 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15258 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15259 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15260 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15261 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15262 | /* hp used DAC 3 (Front) */ |
| 15263 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15264 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15265 | { } |
| 15266 | }; |
| 15267 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15268 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15269 | /* |
| 15270 | * Unmute ADC0 and set the default input to mic-in |
| 15271 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15272 | /* port-A for surround (rear panel) |
| 15273 | * according to codec#0 this is the HP jack |
| 15274 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15275 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15276 | /* route front PCM to HP */ |
| 15277 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15278 | /* port-B for mic-in (rear panel) with vref */ |
| 15279 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15280 | /* port-C for line-in (rear panel) */ |
| 15281 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15282 | /* port-D for Front */ |
| 15283 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15284 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15285 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15286 | /* this has to be set to VREF80 */ |
| 15287 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15288 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15289 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15290 | /* port-F for mic-in (front panel) with vref */ |
| 15291 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15292 | /* port-G for CLFE (rear panel) */ |
| 15293 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15294 | /* port-H for side (rear panel) */ |
| 15295 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15296 | /* CD-in */ |
| 15297 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15298 | /* route front mic to ADC1*/ |
| 15299 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15300 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15301 | /* Unmute DAC0~3 & spdif out*/ |
| 15302 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15303 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15304 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15305 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15306 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15307 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15308 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15309 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15310 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15311 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15312 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15313 | /* Unmute Stereo Mixer 15 */ |
| 15314 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15315 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15316 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15317 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15318 | |
| 15319 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15320 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15321 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15322 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15323 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15324 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15325 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15326 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15327 | /* hp used DAC 3 (Front) */ |
| 15328 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15329 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15330 | { } |
| 15331 | }; |
| 15332 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15333 | /* additional init verbs for ASUS laptops */ |
| 15334 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15335 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15336 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15337 | { } |
| 15338 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15339 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15340 | /* |
| 15341 | * generic initialization of ADC, input mixers and output mixers |
| 15342 | */ |
| 15343 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15344 | /* |
| 15345 | * Unmute ADC0 and set the default input to mic-in |
| 15346 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15347 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15348 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15349 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15350 | /* Unmute DAC0~3 & spdif out*/ |
| 15351 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15352 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15353 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15354 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15355 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15356 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15357 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15358 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15359 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15360 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15361 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15362 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15363 | /* Unmute Stereo Mixer 15 */ |
| 15364 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15365 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15366 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15367 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15368 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15369 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15370 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15371 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15372 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15373 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15374 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15375 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15376 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15377 | |
| 15378 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15379 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15380 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15381 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15382 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15383 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15384 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15385 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15386 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15387 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15388 | |
| 15389 | { } |
| 15390 | }; |
| 15391 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15392 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15393 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15394 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15395 | { } |
| 15396 | }; |
| 15397 | |
| 15398 | /* toggle speaker-output according to the hp-jack state */ |
| 15399 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15400 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15401 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15402 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15403 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15404 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15405 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15406 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15407 | } |
| 15408 | |
| 15409 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15410 | unsigned int res) |
| 15411 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15412 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15413 | alc861_toshiba_automute(codec); |
| 15414 | } |
| 15415 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15416 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15417 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15418 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15419 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15420 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15421 | |
| 15422 | |
| 15423 | #define ALC861_DIGOUT_NID 0x07 |
| 15424 | |
| 15425 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15426 | { 8, NULL } |
| 15427 | }; |
| 15428 | |
| 15429 | static hda_nid_t alc861_dac_nids[4] = { |
| 15430 | /* front, surround, clfe, side */ |
| 15431 | 0x03, 0x06, 0x05, 0x04 |
| 15432 | }; |
| 15433 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15434 | static hda_nid_t alc660_dac_nids[3] = { |
| 15435 | /* front, clfe, surround */ |
| 15436 | 0x03, 0x05, 0x06 |
| 15437 | }; |
| 15438 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15439 | static hda_nid_t alc861_adc_nids[1] = { |
| 15440 | /* ADC0-2 */ |
| 15441 | 0x08, |
| 15442 | }; |
| 15443 | |
| 15444 | static struct hda_input_mux alc861_capture_source = { |
| 15445 | .num_items = 5, |
| 15446 | .items = { |
| 15447 | { "Mic", 0x0 }, |
| 15448 | { "Front Mic", 0x3 }, |
| 15449 | { "Line", 0x1 }, |
| 15450 | { "CD", 0x4 }, |
| 15451 | { "Mixer", 0x5 }, |
| 15452 | }, |
| 15453 | }; |
| 15454 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15455 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15456 | { |
| 15457 | struct alc_spec *spec = codec->spec; |
| 15458 | hda_nid_t mix, srcs[5]; |
| 15459 | int i, j, num; |
| 15460 | |
| 15461 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15462 | return 0; |
| 15463 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15464 | if (num < 0) |
| 15465 | return 0; |
| 15466 | for (i = 0; i < num; i++) { |
| 15467 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15468 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15469 | if (type != AC_WID_AUD_OUT) |
| 15470 | continue; |
| 15471 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15472 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15473 | break; |
| 15474 | if (j >= spec->multiout.num_dacs) |
| 15475 | return srcs[i]; |
| 15476 | } |
| 15477 | return 0; |
| 15478 | } |
| 15479 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15480 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15481 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15482 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15483 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15484 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15485 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15486 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15487 | |
| 15488 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15489 | for (i = 0; i < cfg->line_outs; i++) { |
| 15490 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15491 | dac = alc861_look_for_dac(codec, nid); |
| 15492 | if (!dac) |
| 15493 | continue; |
| 15494 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15495 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15496 | return 0; |
| 15497 | } |
| 15498 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15499 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15500 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15501 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15502 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15503 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15504 | } |
| 15505 | |
| 15506 | /* add playback controls from the parsed DAC table */ |
| 15507 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15508 | const struct auto_pin_cfg *cfg) |
| 15509 | { |
| 15510 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15511 | static const char *chname[4] = { |
| 15512 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15513 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15514 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15515 | int i, err; |
| 15516 | |
| 15517 | if (cfg->line_outs == 1) { |
| 15518 | const char *pfx = NULL; |
| 15519 | if (!cfg->hp_outs) |
| 15520 | pfx = "Master"; |
| 15521 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15522 | pfx = "Speaker"; |
| 15523 | if (pfx) { |
| 15524 | nid = spec->multiout.dac_nids[0]; |
| 15525 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 15526 | } |
| 15527 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15528 | |
| 15529 | for (i = 0; i < cfg->line_outs; i++) { |
| 15530 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15531 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15532 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15533 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15534 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15535 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15536 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15537 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15538 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15539 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15540 | return err; |
| 15541 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15542 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15543 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15544 | return err; |
| 15545 | } |
| 15546 | } |
| 15547 | return 0; |
| 15548 | } |
| 15549 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15550 | 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] | 15551 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15552 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15553 | int err; |
| 15554 | hda_nid_t nid; |
| 15555 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15556 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15557 | return 0; |
| 15558 | |
| 15559 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15560 | nid = alc861_look_for_dac(codec, pin); |
| 15561 | if (nid) { |
| 15562 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15563 | if (err < 0) |
| 15564 | return err; |
| 15565 | spec->multiout.hp_nid = nid; |
| 15566 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15567 | } |
| 15568 | return 0; |
| 15569 | } |
| 15570 | |
| 15571 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15572 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15573 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15574 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15575 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15576 | } |
| 15577 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15578 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15579 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15580 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15581 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15582 | hda_nid_t mix, srcs[5]; |
| 15583 | int i, num; |
| 15584 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15585 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15586 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15587 | 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] | 15588 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15589 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 15590 | return; |
| 15591 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15592 | if (num < 0) |
| 15593 | return; |
| 15594 | for (i = 0; i < num; i++) { |
| 15595 | unsigned int mute; |
| 15596 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 15597 | mute = AMP_IN_UNMUTE(i); |
| 15598 | else |
| 15599 | mute = AMP_IN_MUTE(i); |
| 15600 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15601 | mute); |
| 15602 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15603 | } |
| 15604 | |
| 15605 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 15606 | { |
| 15607 | struct alc_spec *spec = codec->spec; |
| 15608 | int i; |
| 15609 | |
| 15610 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 15611 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15612 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15613 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15614 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15615 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15616 | } |
| 15617 | } |
| 15618 | |
| 15619 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 15620 | { |
| 15621 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15622 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15623 | if (spec->autocfg.hp_outs) |
| 15624 | alc861_auto_set_output_and_unmute(codec, |
| 15625 | spec->autocfg.hp_pins[0], |
| 15626 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15627 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15628 | if (spec->autocfg.speaker_outs) |
| 15629 | alc861_auto_set_output_and_unmute(codec, |
| 15630 | spec->autocfg.speaker_pins[0], |
| 15631 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15632 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15633 | } |
| 15634 | |
| 15635 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 15636 | { |
| 15637 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 15638 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15639 | int i; |
| 15640 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 15641 | for (i = 0; i < cfg->num_inputs; i++) { |
| 15642 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15643 | if (nid >= 0x0c && nid <= 0x11) |
| 15644 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15645 | } |
| 15646 | } |
| 15647 | |
| 15648 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15649 | /* return 1 if successful, 0 if the proper config is not found, |
| 15650 | * or a negative error code |
| 15651 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15652 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 15653 | { |
| 15654 | struct alc_spec *spec = codec->spec; |
| 15655 | int err; |
| 15656 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 15657 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15658 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15659 | alc861_ignore); |
| 15660 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15661 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15662 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15663 | return 0; /* can't find valid BIOS pin config */ |
| 15664 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15665 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15666 | if (err < 0) |
| 15667 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15668 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15669 | if (err < 0) |
| 15670 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15671 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15672 | if (err < 0) |
| 15673 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15674 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15675 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15676 | return err; |
| 15677 | |
| 15678 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15679 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 15680 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15681 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15682 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15683 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15684 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15685 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15686 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 15687 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15688 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15689 | |
| 15690 | spec->adc_nids = alc861_adc_nids; |
| 15691 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15692 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15693 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 15694 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15695 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15696 | return 1; |
| 15697 | } |
| 15698 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15699 | /* additional initialization for auto-configuration model */ |
| 15700 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15701 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15702 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15703 | alc861_auto_init_multi_out(codec); |
| 15704 | alc861_auto_init_hp_out(codec); |
| 15705 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 15706 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15707 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15708 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15709 | } |
| 15710 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15711 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15712 | static struct hda_amp_list alc861_loopbacks[] = { |
| 15713 | { 0x15, HDA_INPUT, 0 }, |
| 15714 | { 0x15, HDA_INPUT, 1 }, |
| 15715 | { 0x15, HDA_INPUT, 2 }, |
| 15716 | { 0x15, HDA_INPUT, 3 }, |
| 15717 | { } /* end */ |
| 15718 | }; |
| 15719 | #endif |
| 15720 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15721 | |
| 15722 | /* |
| 15723 | * configuration and preset |
| 15724 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15725 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 15726 | [ALC861_3ST] = "3stack", |
| 15727 | [ALC660_3ST] = "3stack-660", |
| 15728 | [ALC861_3ST_DIG] = "3stack-dig", |
| 15729 | [ALC861_6ST_DIG] = "6stack-dig", |
| 15730 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 15731 | [ALC861_TOSHIBA] = "toshiba", |
| 15732 | [ALC861_ASUS] = "asus", |
| 15733 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 15734 | [ALC861_AUTO] = "auto", |
| 15735 | }; |
| 15736 | |
| 15737 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 15738 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15739 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15740 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15741 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15742 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 15743 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 15744 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 15745 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 15746 | * Any other models that need this preset? |
| 15747 | */ |
| 15748 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 15749 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 15750 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15751 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 15752 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 15753 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 15754 | /* FIXME: the below seems conflict */ |
| 15755 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 15756 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 15757 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15758 | {} |
| 15759 | }; |
| 15760 | |
| 15761 | static struct alc_config_preset alc861_presets[] = { |
| 15762 | [ALC861_3ST] = { |
| 15763 | .mixers = { alc861_3ST_mixer }, |
| 15764 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15765 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15766 | .dac_nids = alc861_dac_nids, |
| 15767 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15768 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15769 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15770 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15771 | .adc_nids = alc861_adc_nids, |
| 15772 | .input_mux = &alc861_capture_source, |
| 15773 | }, |
| 15774 | [ALC861_3ST_DIG] = { |
| 15775 | .mixers = { alc861_base_mixer }, |
| 15776 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15777 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15778 | .dac_nids = alc861_dac_nids, |
| 15779 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15780 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15781 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15782 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15783 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15784 | .adc_nids = alc861_adc_nids, |
| 15785 | .input_mux = &alc861_capture_source, |
| 15786 | }, |
| 15787 | [ALC861_6ST_DIG] = { |
| 15788 | .mixers = { alc861_base_mixer }, |
| 15789 | .init_verbs = { alc861_base_init_verbs }, |
| 15790 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15791 | .dac_nids = alc861_dac_nids, |
| 15792 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15793 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 15794 | .channel_mode = alc861_8ch_modes, |
| 15795 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15796 | .adc_nids = alc861_adc_nids, |
| 15797 | .input_mux = &alc861_capture_source, |
| 15798 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15799 | [ALC660_3ST] = { |
| 15800 | .mixers = { alc861_3ST_mixer }, |
| 15801 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15802 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 15803 | .dac_nids = alc660_dac_nids, |
| 15804 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15805 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15806 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15807 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15808 | .adc_nids = alc861_adc_nids, |
| 15809 | .input_mux = &alc861_capture_source, |
| 15810 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15811 | [ALC861_UNIWILL_M31] = { |
| 15812 | .mixers = { alc861_uniwill_m31_mixer }, |
| 15813 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 15814 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15815 | .dac_nids = alc861_dac_nids, |
| 15816 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15817 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15818 | .channel_mode = alc861_uniwill_m31_modes, |
| 15819 | .need_dac_fix = 1, |
| 15820 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15821 | .adc_nids = alc861_adc_nids, |
| 15822 | .input_mux = &alc861_capture_source, |
| 15823 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15824 | [ALC861_TOSHIBA] = { |
| 15825 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15826 | .init_verbs = { alc861_base_init_verbs, |
| 15827 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15828 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15829 | .dac_nids = alc861_dac_nids, |
| 15830 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15831 | .channel_mode = alc883_3ST_2ch_modes, |
| 15832 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15833 | .adc_nids = alc861_adc_nids, |
| 15834 | .input_mux = &alc861_capture_source, |
| 15835 | .unsol_event = alc861_toshiba_unsol_event, |
| 15836 | .init_hook = alc861_toshiba_automute, |
| 15837 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15838 | [ALC861_ASUS] = { |
| 15839 | .mixers = { alc861_asus_mixer }, |
| 15840 | .init_verbs = { alc861_asus_init_verbs }, |
| 15841 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15842 | .dac_nids = alc861_dac_nids, |
| 15843 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15844 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 15845 | .channel_mode = alc861_asus_modes, |
| 15846 | .need_dac_fix = 1, |
| 15847 | .hp_nid = 0x06, |
| 15848 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15849 | .adc_nids = alc861_adc_nids, |
| 15850 | .input_mux = &alc861_capture_source, |
| 15851 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15852 | [ALC861_ASUS_LAPTOP] = { |
| 15853 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 15854 | .init_verbs = { alc861_asus_init_verbs, |
| 15855 | alc861_asus_laptop_init_verbs }, |
| 15856 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15857 | .dac_nids = alc861_dac_nids, |
| 15858 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15859 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15860 | .channel_mode = alc883_3ST_2ch_modes, |
| 15861 | .need_dac_fix = 1, |
| 15862 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15863 | .adc_nids = alc861_adc_nids, |
| 15864 | .input_mux = &alc861_capture_source, |
| 15865 | }, |
| 15866 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15867 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15868 | /* Pin config fixes */ |
| 15869 | enum { |
| 15870 | PINFIX_FSC_AMILO_PI1505, |
| 15871 | }; |
| 15872 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15873 | static const struct alc_fixup alc861_fixups[] = { |
| 15874 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 15875 | .pins = (const struct alc_pincfg[]) { |
| 15876 | { 0x0b, 0x0221101f }, /* HP */ |
| 15877 | { 0x0f, 0x90170310 }, /* speaker */ |
| 15878 | { } |
| 15879 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15880 | }, |
| 15881 | }; |
| 15882 | |
| 15883 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 15884 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 15885 | {} |
| 15886 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15887 | |
| 15888 | static int patch_alc861(struct hda_codec *codec) |
| 15889 | { |
| 15890 | struct alc_spec *spec; |
| 15891 | int board_config; |
| 15892 | int err; |
| 15893 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 15894 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15895 | if (spec == NULL) |
| 15896 | return -ENOMEM; |
| 15897 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15898 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15899 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15900 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 15901 | alc861_models, |
| 15902 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15903 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15904 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15905 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15906 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15907 | board_config = ALC861_AUTO; |
| 15908 | } |
| 15909 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 15910 | if (board_config == ALC861_AUTO) |
| 15911 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15912 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15913 | if (board_config == ALC861_AUTO) { |
| 15914 | /* automatic parse from the BIOS config */ |
| 15915 | err = alc861_parse_auto_config(codec); |
| 15916 | if (err < 0) { |
| 15917 | alc_free(codec); |
| 15918 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15919 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15920 | printk(KERN_INFO |
| 15921 | "hda_codec: Cannot set up configuration " |
| 15922 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15923 | board_config = ALC861_3ST_DIG; |
| 15924 | } |
| 15925 | } |
| 15926 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15927 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15928 | if (err < 0) { |
| 15929 | alc_free(codec); |
| 15930 | return err; |
| 15931 | } |
| 15932 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15933 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15934 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15935 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15936 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 15937 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 15938 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15939 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 15940 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 15941 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 15942 | if (!spec->cap_mixer) |
| 15943 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15944 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 15945 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15946 | spec->vmaster_nid = 0x03; |
| 15947 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 15948 | if (board_config == ALC861_AUTO) |
| 15949 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); |
| 15950 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15951 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15952 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15953 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15954 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15955 | spec->power_hook = alc_power_eapd; |
| 15956 | #endif |
| 15957 | } |
| 15958 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15959 | if (!spec->loopback.amplist) |
| 15960 | spec->loopback.amplist = alc861_loopbacks; |
| 15961 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15962 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15963 | return 0; |
| 15964 | } |
| 15965 | |
| 15966 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15967 | * ALC861-VD support |
| 15968 | * |
| 15969 | * Based on ALC882 |
| 15970 | * |
| 15971 | * In addition, an independent DAC |
| 15972 | */ |
| 15973 | #define ALC861VD_DIGOUT_NID 0x06 |
| 15974 | |
| 15975 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 15976 | /* front, surr, clfe, side surr */ |
| 15977 | 0x02, 0x03, 0x04, 0x05 |
| 15978 | }; |
| 15979 | |
| 15980 | /* dac_nids for ALC660vd are in a different order - according to |
| 15981 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15982 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15983 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 15984 | * - and it is the same as in 861vd. |
| 15985 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 15986 | */ |
| 15987 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 15988 | /* front, rear, clfe, rear_surr */ |
| 15989 | 0x02, 0x04, 0x03 |
| 15990 | }; |
| 15991 | |
| 15992 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 15993 | /* ADC0 */ |
| 15994 | 0x09, |
| 15995 | }; |
| 15996 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15997 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 15998 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15999 | /* input MUX */ |
| 16000 | /* FIXME: should be a matrix-type input source selection */ |
| 16001 | static struct hda_input_mux alc861vd_capture_source = { |
| 16002 | .num_items = 4, |
| 16003 | .items = { |
| 16004 | { "Mic", 0x0 }, |
| 16005 | { "Front Mic", 0x1 }, |
| 16006 | { "Line", 0x2 }, |
| 16007 | { "CD", 0x4 }, |
| 16008 | }, |
| 16009 | }; |
| 16010 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16011 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16012 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16013 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16014 | { "Ext Mic", 0x0 }, |
| 16015 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16016 | }, |
| 16017 | }; |
| 16018 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16019 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 16020 | .num_items = 2, |
| 16021 | .items = { |
| 16022 | { "Front Mic", 0x0 }, |
| 16023 | { "ATAPI Mic", 0x1 }, |
| 16024 | }, |
| 16025 | }; |
| 16026 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16027 | /* |
| 16028 | * 2ch mode |
| 16029 | */ |
| 16030 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 16031 | { 2, NULL } |
| 16032 | }; |
| 16033 | |
| 16034 | /* |
| 16035 | * 6ch mode |
| 16036 | */ |
| 16037 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 16038 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16039 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16040 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16041 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16042 | { } /* end */ |
| 16043 | }; |
| 16044 | |
| 16045 | /* |
| 16046 | * 8ch mode |
| 16047 | */ |
| 16048 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 16049 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16050 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16051 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16052 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16053 | { } /* end */ |
| 16054 | }; |
| 16055 | |
| 16056 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 16057 | { 6, alc861vd_6stack_ch6_init }, |
| 16058 | { 8, alc861vd_6stack_ch8_init }, |
| 16059 | }; |
| 16060 | |
| 16061 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16062 | { |
| 16063 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16064 | .name = "Channel Mode", |
| 16065 | .info = alc_ch_mode_info, |
| 16066 | .get = alc_ch_mode_get, |
| 16067 | .put = alc_ch_mode_put, |
| 16068 | }, |
| 16069 | { } /* end */ |
| 16070 | }; |
| 16071 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16072 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16073 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16074 | */ |
| 16075 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16076 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16077 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16078 | |
| 16079 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16080 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16081 | |
| 16082 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16083 | HDA_OUTPUT), |
| 16084 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16085 | HDA_OUTPUT), |
| 16086 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16087 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16088 | |
| 16089 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16090 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16091 | |
| 16092 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16093 | |
| 16094 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16095 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16096 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16097 | |
| 16098 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16099 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16100 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16101 | |
| 16102 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16103 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16104 | |
| 16105 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16106 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16107 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16108 | { } /* end */ |
| 16109 | }; |
| 16110 | |
| 16111 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16112 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16113 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16114 | |
| 16115 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16116 | |
| 16117 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16118 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16119 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16120 | |
| 16121 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16122 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16123 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16124 | |
| 16125 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16126 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16127 | |
| 16128 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16129 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16130 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16131 | { } /* end */ |
| 16132 | }; |
| 16133 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16134 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16135 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16136 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16137 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16138 | |
| 16139 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16140 | |
| 16141 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16142 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16143 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16144 | |
| 16145 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16146 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16147 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16148 | |
| 16149 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16150 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16151 | |
| 16152 | { } /* end */ |
| 16153 | }; |
| 16154 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16155 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 16156 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16157 | */ |
| 16158 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16159 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16160 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16161 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16162 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16163 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16164 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16165 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16166 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16167 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16168 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16169 | { } /* end */ |
| 16170 | }; |
| 16171 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16172 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16173 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16174 | */ |
| 16175 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16176 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16177 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16178 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16179 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16180 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16181 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16182 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16183 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16184 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16185 | { } /* end */ |
| 16186 | }; |
| 16187 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16188 | /* |
| 16189 | * generic initialization of ADC, input mixers and output mixers |
| 16190 | */ |
| 16191 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16192 | /* |
| 16193 | * Unmute ADC0 and set the default input to mic-in |
| 16194 | */ |
| 16195 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16196 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16197 | |
| 16198 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16199 | * the analog-loopback mixer widget |
| 16200 | */ |
| 16201 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16202 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16203 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16204 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16205 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16206 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16207 | |
| 16208 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16209 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16210 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16211 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16212 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16213 | |
| 16214 | /* |
| 16215 | * Set up output mixers (0x02 - 0x05) |
| 16216 | */ |
| 16217 | /* set vol=0 to output mixers */ |
| 16218 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16219 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16220 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16221 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16222 | |
| 16223 | /* set up input amps for analog loopback */ |
| 16224 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16225 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16226 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16227 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16228 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16229 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16230 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16231 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16232 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16233 | |
| 16234 | { } |
| 16235 | }; |
| 16236 | |
| 16237 | /* |
| 16238 | * 3-stack pin configuration: |
| 16239 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16240 | */ |
| 16241 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16242 | /* |
| 16243 | * Set pin mode and muting |
| 16244 | */ |
| 16245 | /* set front pin widgets 0x14 for output */ |
| 16246 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16247 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16248 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16249 | |
| 16250 | /* Mic (rear) pin: input vref at 80% */ |
| 16251 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16252 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16253 | /* Front Mic pin: input vref at 80% */ |
| 16254 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16255 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16256 | /* Line In pin: input */ |
| 16257 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16258 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16259 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16260 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16261 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16262 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16263 | /* CD pin widget for input */ |
| 16264 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16265 | |
| 16266 | { } |
| 16267 | }; |
| 16268 | |
| 16269 | /* |
| 16270 | * 6-stack pin configuration: |
| 16271 | */ |
| 16272 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16273 | /* |
| 16274 | * Set pin mode and muting |
| 16275 | */ |
| 16276 | /* set front pin widgets 0x14 for output */ |
| 16277 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16278 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16279 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16280 | |
| 16281 | /* Rear Pin: output 1 (0x0d) */ |
| 16282 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16283 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16284 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16285 | /* CLFE Pin: output 2 (0x0e) */ |
| 16286 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16287 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16288 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16289 | /* Side Pin: output 3 (0x0f) */ |
| 16290 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16291 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16292 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16293 | |
| 16294 | /* Mic (rear) pin: input vref at 80% */ |
| 16295 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16296 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16297 | /* Front Mic pin: input vref at 80% */ |
| 16298 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16299 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16300 | /* Line In pin: input */ |
| 16301 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16302 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16303 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16304 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16305 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16306 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16307 | /* CD pin widget for input */ |
| 16308 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16309 | |
| 16310 | { } |
| 16311 | }; |
| 16312 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16313 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16314 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16315 | { } |
| 16316 | }; |
| 16317 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16318 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16319 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16320 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16321 | { } |
| 16322 | }; |
| 16323 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16324 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16325 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16326 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16327 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16328 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16329 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16330 | {} |
| 16331 | }; |
| 16332 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16333 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 16334 | { |
| 16335 | unsigned int present; |
| 16336 | unsigned char bits; |
| 16337 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16338 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16339 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16340 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16341 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 16342 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16343 | } |
| 16344 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16345 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16346 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16347 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16348 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16349 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16350 | } |
| 16351 | |
| 16352 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16353 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16354 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16355 | alc861vd_lenovo_mic_automute(codec); |
| 16356 | } |
| 16357 | |
| 16358 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16359 | unsigned int res) |
| 16360 | { |
| 16361 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16362 | case ALC880_MIC_EVENT: |
| 16363 | alc861vd_lenovo_mic_automute(codec); |
| 16364 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16365 | default: |
| 16366 | alc_automute_amp_unsol_event(codec, res); |
| 16367 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16368 | } |
| 16369 | } |
| 16370 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16371 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16372 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16373 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16374 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16375 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16376 | |
| 16377 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16378 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16379 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16380 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16381 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16382 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16383 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16384 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16385 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16386 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16387 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16388 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16389 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16390 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16391 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16392 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16393 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16394 | |
| 16395 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16396 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16397 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16398 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16399 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16400 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16401 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16402 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16403 | |
| 16404 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16405 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16406 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16407 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16408 | |
| 16409 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16410 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16411 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16412 | |
| 16413 | { } /* end */ |
| 16414 | }; |
| 16415 | |
| 16416 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16417 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16418 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16419 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16420 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16421 | spec->autocfg.hp_pins[0] = 0x15; |
| 16422 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16423 | } |
| 16424 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16425 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16426 | #define alc861vd_loopbacks alc880_loopbacks |
| 16427 | #endif |
| 16428 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16429 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16430 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16431 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16432 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16433 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16434 | |
| 16435 | /* |
| 16436 | * configuration and preset |
| 16437 | */ |
| 16438 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 16439 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16440 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16441 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16442 | [ALC861VD_3ST] = "3stack", |
| 16443 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16444 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16445 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16446 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16447 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16448 | [ALC861VD_AUTO] = "auto", |
| 16449 | }; |
| 16450 | |
| 16451 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16452 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16453 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16454 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16455 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16456 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16457 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16458 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16459 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16460 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16461 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16462 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16463 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16464 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16465 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16466 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16467 | {} |
| 16468 | }; |
| 16469 | |
| 16470 | static struct alc_config_preset alc861vd_presets[] = { |
| 16471 | [ALC660VD_3ST] = { |
| 16472 | .mixers = { alc861vd_3st_mixer }, |
| 16473 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16474 | alc861vd_3stack_init_verbs }, |
| 16475 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16476 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16477 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16478 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16479 | .input_mux = &alc861vd_capture_source, |
| 16480 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16481 | [ALC660VD_3ST_DIG] = { |
| 16482 | .mixers = { alc861vd_3st_mixer }, |
| 16483 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16484 | alc861vd_3stack_init_verbs }, |
| 16485 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16486 | .dac_nids = alc660vd_dac_nids, |
| 16487 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16488 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16489 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16490 | .input_mux = &alc861vd_capture_source, |
| 16491 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16492 | [ALC861VD_3ST] = { |
| 16493 | .mixers = { alc861vd_3st_mixer }, |
| 16494 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16495 | alc861vd_3stack_init_verbs }, |
| 16496 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16497 | .dac_nids = alc861vd_dac_nids, |
| 16498 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16499 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16500 | .input_mux = &alc861vd_capture_source, |
| 16501 | }, |
| 16502 | [ALC861VD_3ST_DIG] = { |
| 16503 | .mixers = { alc861vd_3st_mixer }, |
| 16504 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16505 | alc861vd_3stack_init_verbs }, |
| 16506 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16507 | .dac_nids = alc861vd_dac_nids, |
| 16508 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16509 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16510 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16511 | .input_mux = &alc861vd_capture_source, |
| 16512 | }, |
| 16513 | [ALC861VD_6ST_DIG] = { |
| 16514 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16515 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16516 | alc861vd_6stack_init_verbs }, |
| 16517 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16518 | .dac_nids = alc861vd_dac_nids, |
| 16519 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16520 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16521 | .channel_mode = alc861vd_6stack_modes, |
| 16522 | .input_mux = &alc861vd_capture_source, |
| 16523 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16524 | [ALC861VD_LENOVO] = { |
| 16525 | .mixers = { alc861vd_lenovo_mixer }, |
| 16526 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16527 | alc861vd_3stack_init_verbs, |
| 16528 | alc861vd_eapd_verbs, |
| 16529 | alc861vd_lenovo_unsol_verbs }, |
| 16530 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16531 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16532 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16533 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16534 | .input_mux = &alc861vd_capture_source, |
| 16535 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16536 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16537 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16538 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16539 | [ALC861VD_DALLAS] = { |
| 16540 | .mixers = { alc861vd_dallas_mixer }, |
| 16541 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16542 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16543 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16544 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16545 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16546 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16547 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16548 | .setup = alc861vd_dallas_setup, |
| 16549 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16550 | }, |
| 16551 | [ALC861VD_HP] = { |
| 16552 | .mixers = { alc861vd_hp_mixer }, |
| 16553 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16554 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16555 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16556 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16557 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16558 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16559 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16560 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16561 | .setup = alc861vd_dallas_setup, |
| 16562 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16563 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16564 | [ALC660VD_ASUS_V1S] = { |
| 16565 | .mixers = { alc861vd_lenovo_mixer }, |
| 16566 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16567 | alc861vd_3stack_init_verbs, |
| 16568 | alc861vd_eapd_verbs, |
| 16569 | alc861vd_lenovo_unsol_verbs }, |
| 16570 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16571 | .dac_nids = alc660vd_dac_nids, |
| 16572 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16573 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16574 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16575 | .input_mux = &alc861vd_capture_source, |
| 16576 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16577 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16578 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16579 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16580 | }; |
| 16581 | |
| 16582 | /* |
| 16583 | * BIOS auto configuration |
| 16584 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16585 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 16586 | const struct auto_pin_cfg *cfg) |
| 16587 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16588 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16589 | } |
| 16590 | |
| 16591 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16592 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16593 | hda_nid_t nid, int pin_type, int dac_idx) |
| 16594 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16595 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16596 | } |
| 16597 | |
| 16598 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 16599 | { |
| 16600 | struct alc_spec *spec = codec->spec; |
| 16601 | int i; |
| 16602 | |
| 16603 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16604 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16605 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16606 | if (nid) |
| 16607 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16608 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16609 | } |
| 16610 | } |
| 16611 | |
| 16612 | |
| 16613 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 16614 | { |
| 16615 | struct alc_spec *spec = codec->spec; |
| 16616 | hda_nid_t pin; |
| 16617 | |
| 16618 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16619 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16620 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16621 | pin = spec->autocfg.speaker_pins[0]; |
| 16622 | if (pin) |
| 16623 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16624 | } |
| 16625 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16626 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 16627 | |
| 16628 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 16629 | { |
| 16630 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16631 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16632 | int i; |
| 16633 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16634 | for (i = 0; i < cfg->num_inputs; i++) { |
| 16635 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16636 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16637 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 16638 | if (nid != ALC861VD_PIN_CD_NID && |
| 16639 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16640 | snd_hda_codec_write(codec, nid, 0, |
| 16641 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16642 | AMP_OUT_MUTE); |
| 16643 | } |
| 16644 | } |
| 16645 | } |
| 16646 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16647 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 16648 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16649 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 16650 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 16651 | |
| 16652 | /* add playback controls from the parsed DAC table */ |
| 16653 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16654 | * different NIDs for mute/unmute switch and volume control */ |
| 16655 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16656 | const struct auto_pin_cfg *cfg) |
| 16657 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16658 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 16659 | hda_nid_t nid_v, nid_s; |
| 16660 | int i, err; |
| 16661 | |
| 16662 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16663 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16664 | continue; |
| 16665 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16666 | alc880_dac_to_idx( |
| 16667 | spec->multiout.dac_nids[i])); |
| 16668 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16669 | alc880_dac_to_idx( |
| 16670 | spec->multiout.dac_nids[i])); |
| 16671 | |
| 16672 | if (i == 2) { |
| 16673 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16674 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16675 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16676 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 16677 | HDA_OUTPUT)); |
| 16678 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16679 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16680 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16681 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16682 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 16683 | HDA_OUTPUT)); |
| 16684 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16685 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16686 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16687 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16688 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 16689 | HDA_INPUT)); |
| 16690 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16691 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16692 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16693 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16694 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 16695 | HDA_INPUT)); |
| 16696 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16697 | return err; |
| 16698 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16699 | const char *pfx; |
| 16700 | if (cfg->line_outs == 1 && |
| 16701 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 16702 | if (!cfg->hp_pins) |
| 16703 | pfx = "Speaker"; |
| 16704 | else |
| 16705 | pfx = "PCM"; |
| 16706 | } else |
| 16707 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16708 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16709 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 16710 | HDA_OUTPUT)); |
| 16711 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16712 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16713 | if (cfg->line_outs == 1 && |
| 16714 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 16715 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16716 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16717 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16718 | HDA_INPUT)); |
| 16719 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16720 | return err; |
| 16721 | } |
| 16722 | } |
| 16723 | return 0; |
| 16724 | } |
| 16725 | |
| 16726 | /* add playback controls for speaker and HP outputs */ |
| 16727 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16728 | * different NIDs for mute/unmute switch and volume control */ |
| 16729 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 16730 | hda_nid_t pin, const char *pfx) |
| 16731 | { |
| 16732 | hda_nid_t nid_v, nid_s; |
| 16733 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16734 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16735 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16736 | return 0; |
| 16737 | |
| 16738 | if (alc880_is_fixed_pin(pin)) { |
| 16739 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16740 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16741 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16742 | spec->multiout.hp_nid = nid_v; |
| 16743 | else |
| 16744 | spec->multiout.extra_out_nid[0] = nid_v; |
| 16745 | /* control HP volume/switch on the output mixer amp */ |
| 16746 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16747 | alc880_fixed_pin_idx(pin)); |
| 16748 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16749 | alc880_fixed_pin_idx(pin)); |
| 16750 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16751 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16752 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 16753 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16754 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16755 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16756 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 16757 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16758 | return err; |
| 16759 | } else if (alc880_is_multi_pin(pin)) { |
| 16760 | /* set manual connection */ |
| 16761 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16762 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16763 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16764 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16765 | return err; |
| 16766 | } |
| 16767 | return 0; |
| 16768 | } |
| 16769 | |
| 16770 | /* parse the BIOS configuration and set up the alc_spec |
| 16771 | * return 1 if successful, 0 if the proper config is not found, |
| 16772 | * or a negative error code |
| 16773 | * Based on ALC880 version - had to change it to override |
| 16774 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 16775 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 16776 | { |
| 16777 | struct alc_spec *spec = codec->spec; |
| 16778 | int err; |
| 16779 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 16780 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16781 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16782 | alc861vd_ignore); |
| 16783 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16784 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16785 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16786 | return 0; /* can't find valid BIOS pin config */ |
| 16787 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16788 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16789 | if (err < 0) |
| 16790 | return err; |
| 16791 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16792 | if (err < 0) |
| 16793 | return err; |
| 16794 | err = alc861vd_auto_create_extra_out(spec, |
| 16795 | spec->autocfg.speaker_pins[0], |
| 16796 | "Speaker"); |
| 16797 | if (err < 0) |
| 16798 | return err; |
| 16799 | err = alc861vd_auto_create_extra_out(spec, |
| 16800 | spec->autocfg.hp_pins[0], |
| 16801 | "Headphone"); |
| 16802 | if (err < 0) |
| 16803 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16804 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16805 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16806 | return err; |
| 16807 | |
| 16808 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16809 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16810 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16811 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16812 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16813 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16814 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16815 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16816 | |
| 16817 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16818 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16819 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 16820 | err = alc_auto_add_mic_boost(codec); |
| 16821 | if (err < 0) |
| 16822 | return err; |
| 16823 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16824 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16825 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16826 | return 1; |
| 16827 | } |
| 16828 | |
| 16829 | /* additional initialization for auto-configuration model */ |
| 16830 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 16831 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16832 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16833 | alc861vd_auto_init_multi_out(codec); |
| 16834 | alc861vd_auto_init_hp_out(codec); |
| 16835 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16836 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16837 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16838 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16839 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16840 | } |
| 16841 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16842 | enum { |
| 16843 | ALC660VD_FIX_ASUS_GPIO1 |
| 16844 | }; |
| 16845 | |
| 16846 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16847 | static const struct alc_fixup alc861vd_fixups[] = { |
| 16848 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16849 | .verbs = (const struct hda_verb[]) { |
| 16850 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 16851 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 16852 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 16853 | { } |
| 16854 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16855 | }, |
| 16856 | }; |
| 16857 | |
| 16858 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 16859 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 16860 | {} |
| 16861 | }; |
| 16862 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16863 | static int patch_alc861vd(struct hda_codec *codec) |
| 16864 | { |
| 16865 | struct alc_spec *spec; |
| 16866 | int err, board_config; |
| 16867 | |
| 16868 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16869 | if (spec == NULL) |
| 16870 | return -ENOMEM; |
| 16871 | |
| 16872 | codec->spec = spec; |
| 16873 | |
| 16874 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 16875 | alc861vd_models, |
| 16876 | alc861vd_cfg_tbl); |
| 16877 | |
| 16878 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16879 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16880 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16881 | board_config = ALC861VD_AUTO; |
| 16882 | } |
| 16883 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16884 | if (board_config == ALC861VD_AUTO) |
| 16885 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16886 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16887 | if (board_config == ALC861VD_AUTO) { |
| 16888 | /* automatic parse from the BIOS config */ |
| 16889 | err = alc861vd_parse_auto_config(codec); |
| 16890 | if (err < 0) { |
| 16891 | alc_free(codec); |
| 16892 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16893 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16894 | printk(KERN_INFO |
| 16895 | "hda_codec: Cannot set up configuration " |
| 16896 | "from BIOS. Using base mode...\n"); |
| 16897 | board_config = ALC861VD_3ST; |
| 16898 | } |
| 16899 | } |
| 16900 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16901 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16902 | if (err < 0) { |
| 16903 | alc_free(codec); |
| 16904 | return err; |
| 16905 | } |
| 16906 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16907 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16908 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16909 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16910 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16911 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16912 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16913 | } |
| 16914 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16915 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 16916 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 16917 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16918 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 16919 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 16920 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 16921 | if (!spec->adc_nids) { |
| 16922 | spec->adc_nids = alc861vd_adc_nids; |
| 16923 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 16924 | } |
| 16925 | if (!spec->capsrc_nids) |
| 16926 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16927 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16928 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16929 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16930 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16931 | spec->vmaster_nid = 0x02; |
| 16932 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16933 | if (board_config == ALC861VD_AUTO) |
| 16934 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); |
| 16935 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16936 | codec->patch_ops = alc_patch_ops; |
| 16937 | |
| 16938 | if (board_config == ALC861VD_AUTO) |
| 16939 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16940 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16941 | if (!spec->loopback.amplist) |
| 16942 | spec->loopback.amplist = alc861vd_loopbacks; |
| 16943 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16944 | |
| 16945 | return 0; |
| 16946 | } |
| 16947 | |
| 16948 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16949 | * ALC662 support |
| 16950 | * |
| 16951 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 16952 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 16953 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 16954 | * 6-channel independent captures. |
| 16955 | * |
| 16956 | * In addition, an independent DAC for the multi-playback (not used in this |
| 16957 | * driver yet). |
| 16958 | */ |
| 16959 | #define ALC662_DIGOUT_NID 0x06 |
| 16960 | #define ALC662_DIGIN_NID 0x0a |
| 16961 | |
| 16962 | static hda_nid_t alc662_dac_nids[4] = { |
| 16963 | /* front, rear, clfe, rear_surr */ |
| 16964 | 0x02, 0x03, 0x04 |
| 16965 | }; |
| 16966 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16967 | static hda_nid_t alc272_dac_nids[2] = { |
| 16968 | 0x02, 0x03 |
| 16969 | }; |
| 16970 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16971 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16972 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16973 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16974 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16975 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16976 | static hda_nid_t alc272_adc_nids[1] = { |
| 16977 | /* ADC1-2 */ |
| 16978 | 0x08, |
| 16979 | }; |
| 16980 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16981 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16982 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 16983 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16984 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16985 | /* input MUX */ |
| 16986 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16987 | static struct hda_input_mux alc662_capture_source = { |
| 16988 | .num_items = 4, |
| 16989 | .items = { |
| 16990 | { "Mic", 0x0 }, |
| 16991 | { "Front Mic", 0x1 }, |
| 16992 | { "Line", 0x2 }, |
| 16993 | { "CD", 0x4 }, |
| 16994 | }, |
| 16995 | }; |
| 16996 | |
| 16997 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 16998 | .num_items = 2, |
| 16999 | .items = { |
| 17000 | { "Mic", 0x1 }, |
| 17001 | { "Line", 0x2 }, |
| 17002 | }, |
| 17003 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17004 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17005 | static struct hda_input_mux alc663_capture_source = { |
| 17006 | .num_items = 3, |
| 17007 | .items = { |
| 17008 | { "Mic", 0x0 }, |
| 17009 | { "Front Mic", 0x1 }, |
| 17010 | { "Line", 0x2 }, |
| 17011 | }, |
| 17012 | }; |
| 17013 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17014 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17015 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 17016 | .num_items = 16, |
| 17017 | .items = { |
| 17018 | { "Autoselect Mic", 0x0 }, |
| 17019 | { "Internal Mic", 0x1 }, |
| 17020 | { "In-0x02", 0x2 }, |
| 17021 | { "In-0x03", 0x3 }, |
| 17022 | { "In-0x04", 0x4 }, |
| 17023 | { "In-0x05", 0x5 }, |
| 17024 | { "In-0x06", 0x6 }, |
| 17025 | { "In-0x07", 0x7 }, |
| 17026 | { "In-0x08", 0x8 }, |
| 17027 | { "In-0x09", 0x9 }, |
| 17028 | { "In-0x0a", 0x0a }, |
| 17029 | { "In-0x0b", 0x0b }, |
| 17030 | { "In-0x0c", 0x0c }, |
| 17031 | { "In-0x0d", 0x0d }, |
| 17032 | { "In-0x0e", 0x0e }, |
| 17033 | { "In-0x0f", 0x0f }, |
| 17034 | }, |
| 17035 | }; |
| 17036 | #endif |
| 17037 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17038 | /* |
| 17039 | * 2ch mode |
| 17040 | */ |
| 17041 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 17042 | { 2, NULL } |
| 17043 | }; |
| 17044 | |
| 17045 | /* |
| 17046 | * 2ch mode |
| 17047 | */ |
| 17048 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 17049 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17050 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17051 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17052 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17053 | { } /* end */ |
| 17054 | }; |
| 17055 | |
| 17056 | /* |
| 17057 | * 6ch mode |
| 17058 | */ |
| 17059 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17060 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17061 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17062 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17063 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17064 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17065 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17066 | { } /* end */ |
| 17067 | }; |
| 17068 | |
| 17069 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17070 | { 2, alc662_3ST_ch2_init }, |
| 17071 | { 6, alc662_3ST_ch6_init }, |
| 17072 | }; |
| 17073 | |
| 17074 | /* |
| 17075 | * 2ch mode |
| 17076 | */ |
| 17077 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17078 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17079 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17080 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17081 | { } /* end */ |
| 17082 | }; |
| 17083 | |
| 17084 | /* |
| 17085 | * 6ch mode |
| 17086 | */ |
| 17087 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17088 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17089 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17090 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17091 | { } /* end */ |
| 17092 | }; |
| 17093 | |
| 17094 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17095 | { 2, alc662_sixstack_ch6_init }, |
| 17096 | { 6, alc662_sixstack_ch8_init }, |
| 17097 | }; |
| 17098 | |
| 17099 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17100 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17101 | */ |
| 17102 | |
| 17103 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17104 | /* output mixer control */ |
| 17105 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17106 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17107 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17108 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17109 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17110 | 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] | 17111 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17112 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17113 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17114 | |
| 17115 | /*Input mixer control */ |
| 17116 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17117 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17118 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17119 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17120 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17121 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17122 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17123 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17124 | { } /* end */ |
| 17125 | }; |
| 17126 | |
| 17127 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17128 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17129 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17130 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17131 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17132 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17133 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17134 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17135 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17136 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17137 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17138 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17139 | { } /* end */ |
| 17140 | }; |
| 17141 | |
| 17142 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17143 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17144 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17145 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17146 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17147 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17148 | 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] | 17149 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17150 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17151 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17152 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17153 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17154 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17155 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17156 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17157 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17158 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17159 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17160 | { } /* end */ |
| 17161 | }; |
| 17162 | |
| 17163 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17164 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17165 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17166 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17167 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17168 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17169 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17170 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17171 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17172 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17173 | { } /* end */ |
| 17174 | }; |
| 17175 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17176 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17177 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17178 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17179 | |
| 17180 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 17181 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17182 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17183 | |
| 17184 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17185 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17186 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17187 | { } /* end */ |
| 17188 | }; |
| 17189 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17190 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17191 | ALC262_HIPPO_MASTER_SWITCH, |
| 17192 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17193 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17194 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17195 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17196 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17197 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17198 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17199 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17200 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17201 | { } /* end */ |
| 17202 | }; |
| 17203 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17204 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17205 | .ops = &snd_hda_bind_vol, |
| 17206 | .values = { |
| 17207 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17208 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17209 | 0 |
| 17210 | }, |
| 17211 | }; |
| 17212 | |
| 17213 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17214 | .ops = &snd_hda_bind_sw, |
| 17215 | .values = { |
| 17216 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17217 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17218 | 0 |
| 17219 | }, |
| 17220 | }; |
| 17221 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17222 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17223 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17224 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17225 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17226 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17227 | { } /* end */ |
| 17228 | }; |
| 17229 | |
| 17230 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17231 | .ops = &snd_hda_bind_sw, |
| 17232 | .values = { |
| 17233 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17234 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17235 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17236 | 0 |
| 17237 | }, |
| 17238 | }; |
| 17239 | |
| 17240 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17241 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17242 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17243 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17244 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17245 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17246 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17247 | |
| 17248 | { } /* end */ |
| 17249 | }; |
| 17250 | |
| 17251 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17252 | .ops = &snd_hda_bind_sw, |
| 17253 | .values = { |
| 17254 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17255 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17256 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17257 | 0 |
| 17258 | }, |
| 17259 | }; |
| 17260 | |
| 17261 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17262 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17263 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17264 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17265 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17266 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17267 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17268 | { } /* end */ |
| 17269 | }; |
| 17270 | |
| 17271 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17272 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17273 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17274 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17275 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17276 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17277 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17278 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17279 | { } /* end */ |
| 17280 | }; |
| 17281 | |
| 17282 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17283 | .ops = &snd_hda_bind_vol, |
| 17284 | .values = { |
| 17285 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17286 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17287 | 0 |
| 17288 | }, |
| 17289 | }; |
| 17290 | |
| 17291 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17292 | .ops = &snd_hda_bind_sw, |
| 17293 | .values = { |
| 17294 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17295 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17296 | 0 |
| 17297 | }, |
| 17298 | }; |
| 17299 | |
| 17300 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17301 | HDA_BIND_VOL("Master Playback Volume", |
| 17302 | &alc663_asus_two_bind_master_vol), |
| 17303 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17304 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17305 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17306 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17307 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17308 | { } /* end */ |
| 17309 | }; |
| 17310 | |
| 17311 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17312 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17313 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17314 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17315 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17316 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17317 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17318 | { } /* end */ |
| 17319 | }; |
| 17320 | |
| 17321 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17322 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17323 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17324 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17325 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17326 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17327 | |
| 17328 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17329 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17330 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17331 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17332 | { } /* end */ |
| 17333 | }; |
| 17334 | |
| 17335 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17336 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17337 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17338 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17339 | |
| 17340 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17341 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17342 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17343 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17344 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17345 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17346 | { } /* end */ |
| 17347 | }; |
| 17348 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17349 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17350 | .ops = &snd_hda_bind_sw, |
| 17351 | .values = { |
| 17352 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17353 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17354 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17355 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17356 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17357 | 0 |
| 17358 | }, |
| 17359 | }; |
| 17360 | |
| 17361 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17362 | .ops = &snd_hda_bind_sw, |
| 17363 | .values = { |
| 17364 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17365 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17366 | 0 |
| 17367 | }, |
| 17368 | }; |
| 17369 | |
| 17370 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17371 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17372 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17373 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17374 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17375 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17376 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17377 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17378 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17379 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17380 | { } /* end */ |
| 17381 | }; |
| 17382 | |
| 17383 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17384 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17385 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17386 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17387 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17388 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17389 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17390 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17391 | { } /* end */ |
| 17392 | }; |
| 17393 | |
| 17394 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17395 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17396 | { |
| 17397 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17398 | .name = "Channel Mode", |
| 17399 | .info = alc_ch_mode_info, |
| 17400 | .get = alc_ch_mode_get, |
| 17401 | .put = alc_ch_mode_put, |
| 17402 | }, |
| 17403 | { } /* end */ |
| 17404 | }; |
| 17405 | |
| 17406 | static struct hda_verb alc662_init_verbs[] = { |
| 17407 | /* ADC: mute amp left and right */ |
| 17408 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17409 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17410 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17411 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17412 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17413 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17414 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17415 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17416 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17417 | |
| 17418 | /* Front Pin: output 0 (0x0c) */ |
| 17419 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17420 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17421 | |
| 17422 | /* Rear Pin: output 1 (0x0d) */ |
| 17423 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17424 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17425 | |
| 17426 | /* CLFE Pin: output 2 (0x0e) */ |
| 17427 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17428 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17429 | |
| 17430 | /* Mic (rear) pin: input vref at 80% */ |
| 17431 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17432 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17433 | /* Front Mic pin: input vref at 80% */ |
| 17434 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17435 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17436 | /* Line In pin: input */ |
| 17437 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17438 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17439 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17440 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17441 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17442 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17443 | /* CD pin widget for input */ |
| 17444 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17445 | |
| 17446 | /* FIXME: use matrix-type input source selection */ |
| 17447 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17448 | /* Input mixer */ |
| 17449 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17450 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17451 | |
| 17452 | /* always trun on EAPD */ |
| 17453 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17454 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17455 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17456 | { } |
| 17457 | }; |
| 17458 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17459 | static struct hda_verb alc663_init_verbs[] = { |
| 17460 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17461 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17462 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17463 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17464 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17465 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17466 | { } |
| 17467 | }; |
| 17468 | |
| 17469 | static struct hda_verb alc272_init_verbs[] = { |
| 17470 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17471 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17472 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17473 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17474 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17475 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17476 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17477 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17478 | { } |
| 17479 | }; |
| 17480 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17481 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17482 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17483 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17484 | {} |
| 17485 | }; |
| 17486 | |
| 17487 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17488 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17489 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17490 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17491 | }; |
| 17492 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17493 | /* Set Unsolicited Event*/ |
| 17494 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17495 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17496 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17497 | {} |
| 17498 | }; |
| 17499 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17500 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17501 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17502 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17503 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17504 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17505 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17506 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17507 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17508 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17509 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17510 | {} |
| 17511 | }; |
| 17512 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17513 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17514 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17515 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17516 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17517 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17518 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17519 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17520 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17521 | {} |
| 17522 | }; |
| 17523 | |
| 17524 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17525 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17526 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17527 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17528 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17529 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17530 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17531 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17532 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17533 | {} |
| 17534 | }; |
| 17535 | |
| 17536 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17537 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17538 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17539 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17540 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17541 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17542 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17543 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17544 | {} |
| 17545 | }; |
| 17546 | |
| 17547 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17548 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17549 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17550 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17551 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17552 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17553 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17554 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17555 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17556 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17557 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17558 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17559 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17560 | {} |
| 17561 | }; |
| 17562 | |
| 17563 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 17564 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17565 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17566 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17567 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17568 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17569 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17570 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17571 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17572 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17573 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17574 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17575 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17576 | {} |
| 17577 | }; |
| 17578 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17579 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 17580 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17581 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 17582 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 17583 | |
| 17584 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17585 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17586 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17587 | |
| 17588 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17589 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17590 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 17591 | {} |
| 17592 | }; |
| 17593 | |
| 17594 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 17595 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17596 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17597 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17598 | |
| 17599 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17600 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17601 | {} |
| 17602 | }; |
| 17603 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17604 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 17605 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 17606 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17607 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17608 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17609 | {} |
| 17610 | }; |
| 17611 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17612 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 17613 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17614 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17615 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17616 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17617 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17618 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17619 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17620 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17621 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17622 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17623 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17624 | {} |
| 17625 | }; |
| 17626 | |
| 17627 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 17628 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17629 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17630 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17631 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17632 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17633 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17634 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17635 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17636 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17637 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17638 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17639 | {} |
| 17640 | }; |
| 17641 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17642 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 17643 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17644 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17645 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17646 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17647 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17648 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17649 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17650 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17651 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17652 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17653 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17654 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17655 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17656 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17657 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17658 | {} |
| 17659 | }; |
| 17660 | |
| 17661 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 17662 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17663 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17664 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17665 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17666 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17667 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17668 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17669 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17670 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17671 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17672 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17673 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17674 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17675 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17676 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17677 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17678 | {} |
| 17679 | }; |
| 17680 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17681 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 17682 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 17683 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 17684 | { } /* end */ |
| 17685 | }; |
| 17686 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17687 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 17688 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 17689 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 17690 | { } /* end */ |
| 17691 | }; |
| 17692 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17693 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 17694 | { |
| 17695 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17696 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17697 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17698 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17699 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17700 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17701 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17702 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17703 | } |
| 17704 | |
| 17705 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 17706 | { |
| 17707 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17708 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17709 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17710 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17711 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17712 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17713 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17714 | HDA_AMP_MUTE, bits); |
| 17715 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17716 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17717 | } |
| 17718 | |
| 17719 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 17720 | unsigned int res) |
| 17721 | { |
| 17722 | if ((res >> 26) == ALC880_HP_EVENT) |
| 17723 | alc662_lenovo_101e_all_automute(codec); |
| 17724 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 17725 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 17726 | } |
| 17727 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17728 | /* unsolicited event for HP jack sensing */ |
| 17729 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 17730 | unsigned int res) |
| 17731 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17732 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17733 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17734 | else |
| 17735 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17736 | } |
| 17737 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17738 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17739 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17740 | struct alc_spec *spec = codec->spec; |
| 17741 | |
| 17742 | alc262_hippo1_setup(codec); |
| 17743 | spec->ext_mic.pin = 0x18; |
| 17744 | spec->ext_mic.mux_idx = 0; |
| 17745 | spec->int_mic.pin = 0x19; |
| 17746 | spec->int_mic.mux_idx = 1; |
| 17747 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17748 | } |
| 17749 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17750 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 17751 | { |
| 17752 | alc262_hippo_automute(codec); |
| 17753 | alc_mic_automute(codec); |
| 17754 | } |
| 17755 | |
| 17756 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17757 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17758 | struct alc_spec *spec = codec->spec; |
| 17759 | |
| 17760 | spec->autocfg.hp_pins[0] = 0x14; |
| 17761 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17762 | } |
| 17763 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17764 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 17765 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17766 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 17767 | { |
| 17768 | unsigned int present; |
| 17769 | unsigned char bits; |
| 17770 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17771 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17772 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17773 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17774 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17775 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17776 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17777 | } |
| 17778 | |
| 17779 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 17780 | { |
| 17781 | unsigned int present; |
| 17782 | unsigned char bits; |
| 17783 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17784 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17785 | bits = present ? HDA_AMP_MUTE : 0; |
| 17786 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17787 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17788 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17789 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17790 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17791 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17792 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17793 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17794 | } |
| 17795 | |
| 17796 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 17797 | { |
| 17798 | unsigned int present; |
| 17799 | unsigned char bits; |
| 17800 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17801 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17802 | bits = present ? HDA_AMP_MUTE : 0; |
| 17803 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17804 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17805 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17806 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17807 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17808 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17809 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17810 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17811 | } |
| 17812 | |
| 17813 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 17814 | { |
| 17815 | unsigned int present; |
| 17816 | unsigned char bits; |
| 17817 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17818 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17819 | bits = present ? 0 : PIN_OUT; |
| 17820 | snd_hda_codec_write(codec, 0x14, 0, |
| 17821 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 17822 | } |
| 17823 | |
| 17824 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 17825 | { |
| 17826 | unsigned int present1, present2; |
| 17827 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17828 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 17829 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17830 | |
| 17831 | if (present1 || present2) { |
| 17832 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17833 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17834 | } else { |
| 17835 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17836 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17837 | } |
| 17838 | } |
| 17839 | |
| 17840 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 17841 | { |
| 17842 | unsigned int present1, present2; |
| 17843 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17844 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 17845 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17846 | |
| 17847 | if (present1 || present2) { |
| 17848 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17849 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17850 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17851 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17852 | } else { |
| 17853 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17854 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17855 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17856 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17857 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17858 | } |
| 17859 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17860 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 17861 | { |
| 17862 | unsigned int present1, present2; |
| 17863 | |
| 17864 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 17865 | AC_VERB_GET_PIN_SENSE, 0) |
| 17866 | & AC_PINSENSE_PRESENCE; |
| 17867 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 17868 | AC_VERB_GET_PIN_SENSE, 0) |
| 17869 | & AC_PINSENSE_PRESENCE; |
| 17870 | |
| 17871 | if (present1 || present2) { |
| 17872 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17873 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17874 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17875 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17876 | } else { |
| 17877 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17878 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17879 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17880 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17881 | } |
| 17882 | } |
| 17883 | |
| 17884 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 17885 | { |
| 17886 | unsigned int present1, present2; |
| 17887 | |
| 17888 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 17889 | AC_VERB_GET_PIN_SENSE, 0) |
| 17890 | & AC_PINSENSE_PRESENCE; |
| 17891 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 17892 | AC_VERB_GET_PIN_SENSE, 0) |
| 17893 | & AC_PINSENSE_PRESENCE; |
| 17894 | |
| 17895 | if (present1 || present2) { |
| 17896 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17897 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17898 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17899 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17900 | } else { |
| 17901 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17902 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17903 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17904 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17905 | } |
| 17906 | } |
| 17907 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17908 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 17909 | unsigned int res) |
| 17910 | { |
| 17911 | switch (res >> 26) { |
| 17912 | case ALC880_HP_EVENT: |
| 17913 | alc663_m51va_speaker_automute(codec); |
| 17914 | break; |
| 17915 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17916 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17917 | break; |
| 17918 | } |
| 17919 | } |
| 17920 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17921 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 17922 | { |
| 17923 | struct alc_spec *spec = codec->spec; |
| 17924 | spec->ext_mic.pin = 0x18; |
| 17925 | spec->ext_mic.mux_idx = 0; |
| 17926 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17927 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17928 | spec->auto_mic = 1; |
| 17929 | } |
| 17930 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17931 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 17932 | { |
| 17933 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17934 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17935 | } |
| 17936 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17937 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17938 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17939 | |
| 17940 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 17941 | { |
| 17942 | struct alc_spec *spec = codec->spec; |
| 17943 | spec->ext_mic.pin = 0x18; |
| 17944 | spec->ext_mic.mux_idx = 0; |
| 17945 | spec->int_mic.pin = 0x19; |
| 17946 | spec->int_mic.mux_idx = 1; |
| 17947 | spec->auto_mic = 1; |
| 17948 | } |
| 17949 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17950 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17951 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17952 | /* ***************** Mode2 ******************************/ |
| 17953 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 17954 | unsigned int res) |
| 17955 | { |
| 17956 | switch (res >> 26) { |
| 17957 | case ALC880_HP_EVENT: |
| 17958 | alc662_f5z_speaker_automute(codec); |
| 17959 | break; |
| 17960 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17961 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17962 | break; |
| 17963 | } |
| 17964 | } |
| 17965 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17966 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17967 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17968 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 17969 | { |
| 17970 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17971 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17972 | } |
| 17973 | /* ***************** Mode3 ******************************/ |
| 17974 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 17975 | unsigned int res) |
| 17976 | { |
| 17977 | switch (res >> 26) { |
| 17978 | case ALC880_HP_EVENT: |
| 17979 | alc663_two_hp_m1_speaker_automute(codec); |
| 17980 | break; |
| 17981 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17982 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17983 | break; |
| 17984 | } |
| 17985 | } |
| 17986 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17987 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17988 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17989 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 17990 | { |
| 17991 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17992 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17993 | } |
| 17994 | /* ***************** Mode4 ******************************/ |
| 17995 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 17996 | unsigned int res) |
| 17997 | { |
| 17998 | switch (res >> 26) { |
| 17999 | case ALC880_HP_EVENT: |
| 18000 | alc663_21jd_two_speaker_automute(codec); |
| 18001 | break; |
| 18002 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18003 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18004 | break; |
| 18005 | } |
| 18006 | } |
| 18007 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18008 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18009 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18010 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 18011 | { |
| 18012 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18013 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18014 | } |
| 18015 | /* ***************** Mode5 ******************************/ |
| 18016 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 18017 | unsigned int res) |
| 18018 | { |
| 18019 | switch (res >> 26) { |
| 18020 | case ALC880_HP_EVENT: |
| 18021 | alc663_15jd_two_speaker_automute(codec); |
| 18022 | break; |
| 18023 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18024 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18025 | break; |
| 18026 | } |
| 18027 | } |
| 18028 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18029 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18030 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18031 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 18032 | { |
| 18033 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18034 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18035 | } |
| 18036 | /* ***************** Mode6 ******************************/ |
| 18037 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 18038 | unsigned int res) |
| 18039 | { |
| 18040 | switch (res >> 26) { |
| 18041 | case ALC880_HP_EVENT: |
| 18042 | alc663_two_hp_m2_speaker_automute(codec); |
| 18043 | break; |
| 18044 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18045 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18046 | break; |
| 18047 | } |
| 18048 | } |
| 18049 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18050 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18051 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18052 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 18053 | { |
| 18054 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18055 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18056 | } |
| 18057 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18058 | /* ***************** Mode7 ******************************/ |
| 18059 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 18060 | unsigned int res) |
| 18061 | { |
| 18062 | switch (res >> 26) { |
| 18063 | case ALC880_HP_EVENT: |
| 18064 | alc663_two_hp_m7_speaker_automute(codec); |
| 18065 | break; |
| 18066 | case ALC880_MIC_EVENT: |
| 18067 | alc_mic_automute(codec); |
| 18068 | break; |
| 18069 | } |
| 18070 | } |
| 18071 | |
| 18072 | #define alc663_mode7_setup alc663_mode1_setup |
| 18073 | |
| 18074 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 18075 | { |
| 18076 | alc663_two_hp_m7_speaker_automute(codec); |
| 18077 | alc_mic_automute(codec); |
| 18078 | } |
| 18079 | |
| 18080 | /* ***************** Mode8 ******************************/ |
| 18081 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 18082 | unsigned int res) |
| 18083 | { |
| 18084 | switch (res >> 26) { |
| 18085 | case ALC880_HP_EVENT: |
| 18086 | alc663_two_hp_m8_speaker_automute(codec); |
| 18087 | break; |
| 18088 | case ALC880_MIC_EVENT: |
| 18089 | alc_mic_automute(codec); |
| 18090 | break; |
| 18091 | } |
| 18092 | } |
| 18093 | |
| 18094 | #define alc663_mode8_setup alc663_m51va_setup |
| 18095 | |
| 18096 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 18097 | { |
| 18098 | alc663_two_hp_m8_speaker_automute(codec); |
| 18099 | alc_mic_automute(codec); |
| 18100 | } |
| 18101 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18102 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 18103 | { |
| 18104 | unsigned int present; |
| 18105 | unsigned char bits; |
| 18106 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18107 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18108 | bits = present ? HDA_AMP_MUTE : 0; |
| 18109 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18110 | HDA_AMP_MUTE, bits); |
| 18111 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18112 | HDA_AMP_MUTE, bits); |
| 18113 | } |
| 18114 | |
| 18115 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 18116 | { |
| 18117 | unsigned int present; |
| 18118 | unsigned char bits; |
| 18119 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18120 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18121 | bits = present ? HDA_AMP_MUTE : 0; |
| 18122 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18123 | HDA_AMP_MUTE, bits); |
| 18124 | } |
| 18125 | |
| 18126 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 18127 | unsigned int res) |
| 18128 | { |
| 18129 | switch (res >> 26) { |
| 18130 | case ALC880_HP_EVENT: |
| 18131 | alc663_g71v_hp_automute(codec); |
| 18132 | break; |
| 18133 | case ALC880_FRONT_EVENT: |
| 18134 | alc663_g71v_front_automute(codec); |
| 18135 | break; |
| 18136 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18137 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18138 | break; |
| 18139 | } |
| 18140 | } |
| 18141 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18142 | #define alc663_g71v_setup alc663_m51va_setup |
| 18143 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18144 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 18145 | { |
| 18146 | alc663_g71v_front_automute(codec); |
| 18147 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18148 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18149 | } |
| 18150 | |
| 18151 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 18152 | unsigned int res) |
| 18153 | { |
| 18154 | switch (res >> 26) { |
| 18155 | case ALC880_HP_EVENT: |
| 18156 | alc663_m51va_speaker_automute(codec); |
| 18157 | break; |
| 18158 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18159 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18160 | break; |
| 18161 | } |
| 18162 | } |
| 18163 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18164 | #define alc663_g50v_setup alc663_m51va_setup |
| 18165 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18166 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 18167 | { |
| 18168 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18169 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18170 | } |
| 18171 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18172 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18173 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18174 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18175 | |
| 18176 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 18177 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18178 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18179 | |
| 18180 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 18181 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18182 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18183 | { } /* end */ |
| 18184 | }; |
| 18185 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18186 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18187 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18188 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18189 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18190 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18191 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18192 | |
| 18193 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18194 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18195 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 18196 | |
| 18197 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18198 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18199 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 18200 | { } /* end */ |
| 18201 | }; |
| 18202 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18203 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18204 | #define alc662_loopbacks alc880_loopbacks |
| 18205 | #endif |
| 18206 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18207 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18208 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18209 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18210 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18211 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18212 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18213 | |
| 18214 | /* |
| 18215 | * configuration and preset |
| 18216 | */ |
| 18217 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 18218 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18219 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18220 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 18221 | [ALC662_5ST_DIG] = "6stack-dig", |
| 18222 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18223 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18224 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18225 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18226 | [ALC663_ASUS_M51VA] = "m51va", |
| 18227 | [ALC663_ASUS_G71V] = "g71v", |
| 18228 | [ALC663_ASUS_H13] = "h13", |
| 18229 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18230 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18231 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18232 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18233 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18234 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18235 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18236 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18237 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18238 | [ALC272_DELL] = "dell", |
| 18239 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18240 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18241 | [ALC662_AUTO] = "auto", |
| 18242 | }; |
| 18243 | |
| 18244 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18245 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18246 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18247 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18248 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18249 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18250 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18251 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18252 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18253 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18254 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18255 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18256 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18257 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18258 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18259 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18260 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18261 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18262 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18263 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18264 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18265 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18266 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18267 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18268 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18269 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18270 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18271 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18272 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18273 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18274 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18275 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18276 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18277 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18278 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18279 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18280 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18281 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18282 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18283 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18284 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18285 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18286 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18287 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18288 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18289 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18290 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18291 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18292 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18293 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18294 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18295 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18296 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18297 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18298 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18299 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18300 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18301 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18302 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18303 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18304 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18305 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18306 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18307 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18308 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18309 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18310 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18311 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 18312 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18313 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18314 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18315 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18316 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18317 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18318 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18319 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18320 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18321 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18322 | {} |
| 18323 | }; |
| 18324 | |
| 18325 | static struct alc_config_preset alc662_presets[] = { |
| 18326 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18327 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18328 | .init_verbs = { alc662_init_verbs }, |
| 18329 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18330 | .dac_nids = alc662_dac_nids, |
| 18331 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18332 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18333 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18334 | .channel_mode = alc662_3ST_2ch_modes, |
| 18335 | .input_mux = &alc662_capture_source, |
| 18336 | }, |
| 18337 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18338 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18339 | .init_verbs = { alc662_init_verbs }, |
| 18340 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18341 | .dac_nids = alc662_dac_nids, |
| 18342 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18343 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18344 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18345 | .channel_mode = alc662_3ST_6ch_modes, |
| 18346 | .need_dac_fix = 1, |
| 18347 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18348 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18349 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18350 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18351 | .init_verbs = { alc662_init_verbs }, |
| 18352 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18353 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18354 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18355 | .channel_mode = alc662_3ST_6ch_modes, |
| 18356 | .need_dac_fix = 1, |
| 18357 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18358 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18359 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18360 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18361 | .init_verbs = { alc662_init_verbs }, |
| 18362 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18363 | .dac_nids = alc662_dac_nids, |
| 18364 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18365 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18366 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18367 | .channel_mode = alc662_5stack_modes, |
| 18368 | .input_mux = &alc662_capture_source, |
| 18369 | }, |
| 18370 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18371 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18372 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18373 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18374 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18375 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18376 | .channel_mode = alc662_3ST_2ch_modes, |
| 18377 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18378 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18379 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18380 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18381 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18382 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18383 | .init_verbs = { alc662_init_verbs, |
| 18384 | alc662_eeepc_sue_init_verbs }, |
| 18385 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18386 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18387 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18388 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18389 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18390 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18391 | .init_hook = alc662_eeepc_inithook, |
| 18392 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18393 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18394 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18395 | alc662_chmode_mixer }, |
| 18396 | .init_verbs = { alc662_init_verbs, |
| 18397 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18398 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18399 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18400 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18401 | .channel_mode = alc662_3ST_6ch_modes, |
| 18402 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18403 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18404 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18405 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18406 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18407 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18408 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18409 | .init_verbs = { alc662_init_verbs, |
| 18410 | alc662_ecs_init_verbs }, |
| 18411 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18412 | .dac_nids = alc662_dac_nids, |
| 18413 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18414 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18415 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18416 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18417 | .init_hook = alc662_eeepc_inithook, |
| 18418 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18419 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18420 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18421 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18422 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18423 | .dac_nids = alc662_dac_nids, |
| 18424 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18425 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18426 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18427 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18428 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18429 | .init_hook = alc663_m51va_inithook, |
| 18430 | }, |
| 18431 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18432 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18433 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 18434 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18435 | .dac_nids = alc662_dac_nids, |
| 18436 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18437 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18438 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18439 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18440 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18441 | .init_hook = alc663_g71v_inithook, |
| 18442 | }, |
| 18443 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18444 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18445 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18446 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18447 | .dac_nids = alc662_dac_nids, |
| 18448 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18449 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18450 | .unsol_event = alc663_m51va_unsol_event, |
| 18451 | .init_hook = alc663_m51va_inithook, |
| 18452 | }, |
| 18453 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18454 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18455 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18456 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18457 | .dac_nids = alc662_dac_nids, |
| 18458 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18459 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18460 | .channel_mode = alc662_3ST_6ch_modes, |
| 18461 | .input_mux = &alc663_capture_source, |
| 18462 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18463 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18464 | .init_hook = alc663_g50v_inithook, |
| 18465 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18466 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18467 | .mixers = { alc663_m51va_mixer }, |
| 18468 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18469 | .init_verbs = { alc662_init_verbs, |
| 18470 | alc663_21jd_amic_init_verbs }, |
| 18471 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18472 | .hp_nid = 0x03, |
| 18473 | .dac_nids = alc662_dac_nids, |
| 18474 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18475 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18476 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18477 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18478 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18479 | .init_hook = alc663_mode1_inithook, |
| 18480 | }, |
| 18481 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18482 | .mixers = { alc662_1bjd_mixer }, |
| 18483 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18484 | .init_verbs = { alc662_init_verbs, |
| 18485 | alc662_1bjd_amic_init_verbs }, |
| 18486 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18487 | .dac_nids = alc662_dac_nids, |
| 18488 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18489 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18490 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18491 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18492 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18493 | .init_hook = alc662_mode2_inithook, |
| 18494 | }, |
| 18495 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18496 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18497 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18498 | .init_verbs = { alc662_init_verbs, |
| 18499 | alc663_two_hp_amic_m1_init_verbs }, |
| 18500 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18501 | .hp_nid = 0x03, |
| 18502 | .dac_nids = alc662_dac_nids, |
| 18503 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18504 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18505 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18506 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18507 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18508 | .init_hook = alc663_mode3_inithook, |
| 18509 | }, |
| 18510 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18511 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18512 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18513 | .init_verbs = { alc662_init_verbs, |
| 18514 | alc663_21jd_amic_init_verbs}, |
| 18515 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18516 | .hp_nid = 0x03, |
| 18517 | .dac_nids = alc662_dac_nids, |
| 18518 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18519 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18520 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18521 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18522 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18523 | .init_hook = alc663_mode4_inithook, |
| 18524 | }, |
| 18525 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18526 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18527 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18528 | .init_verbs = { alc662_init_verbs, |
| 18529 | alc663_15jd_amic_init_verbs }, |
| 18530 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18531 | .hp_nid = 0x03, |
| 18532 | .dac_nids = alc662_dac_nids, |
| 18533 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18534 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18535 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18536 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18537 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18538 | .init_hook = alc663_mode5_inithook, |
| 18539 | }, |
| 18540 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18541 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18542 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18543 | .init_verbs = { alc662_init_verbs, |
| 18544 | alc663_two_hp_amic_m2_init_verbs }, |
| 18545 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18546 | .hp_nid = 0x03, |
| 18547 | .dac_nids = alc662_dac_nids, |
| 18548 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18549 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18550 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18551 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18552 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18553 | .init_hook = alc663_mode6_inithook, |
| 18554 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18555 | [ALC663_ASUS_MODE7] = { |
| 18556 | .mixers = { alc663_mode7_mixer }, |
| 18557 | .cap_mixer = alc662_auto_capture_mixer, |
| 18558 | .init_verbs = { alc662_init_verbs, |
| 18559 | alc663_mode7_init_verbs }, |
| 18560 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18561 | .hp_nid = 0x03, |
| 18562 | .dac_nids = alc662_dac_nids, |
| 18563 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18564 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18565 | .channel_mode = alc662_3ST_2ch_modes, |
| 18566 | .unsol_event = alc663_mode7_unsol_event, |
| 18567 | .setup = alc663_mode7_setup, |
| 18568 | .init_hook = alc663_mode7_inithook, |
| 18569 | }, |
| 18570 | [ALC663_ASUS_MODE8] = { |
| 18571 | .mixers = { alc663_mode8_mixer }, |
| 18572 | .cap_mixer = alc662_auto_capture_mixer, |
| 18573 | .init_verbs = { alc662_init_verbs, |
| 18574 | alc663_mode8_init_verbs }, |
| 18575 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18576 | .hp_nid = 0x03, |
| 18577 | .dac_nids = alc662_dac_nids, |
| 18578 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18579 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18580 | .channel_mode = alc662_3ST_2ch_modes, |
| 18581 | .unsol_event = alc663_mode8_unsol_event, |
| 18582 | .setup = alc663_mode8_setup, |
| 18583 | .init_hook = alc663_mode8_inithook, |
| 18584 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18585 | [ALC272_DELL] = { |
| 18586 | .mixers = { alc663_m51va_mixer }, |
| 18587 | .cap_mixer = alc272_auto_capture_mixer, |
| 18588 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 18589 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18590 | .dac_nids = alc662_dac_nids, |
| 18591 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18592 | .adc_nids = alc272_adc_nids, |
| 18593 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18594 | .capsrc_nids = alc272_capsrc_nids, |
| 18595 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18596 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18597 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18598 | .init_hook = alc663_m51va_inithook, |
| 18599 | }, |
| 18600 | [ALC272_DELL_ZM1] = { |
| 18601 | .mixers = { alc663_m51va_mixer }, |
| 18602 | .cap_mixer = alc662_auto_capture_mixer, |
| 18603 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 18604 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18605 | .dac_nids = alc662_dac_nids, |
| 18606 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18607 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18608 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18609 | .capsrc_nids = alc662_capsrc_nids, |
| 18610 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18611 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18612 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18613 | .init_hook = alc663_m51va_inithook, |
| 18614 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18615 | [ALC272_SAMSUNG_NC10] = { |
| 18616 | .mixers = { alc272_nc10_mixer }, |
| 18617 | .init_verbs = { alc662_init_verbs, |
| 18618 | alc663_21jd_amic_init_verbs }, |
| 18619 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18620 | .dac_nids = alc272_dac_nids, |
| 18621 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18622 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18623 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18624 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18625 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18626 | .init_hook = alc663_mode4_inithook, |
| 18627 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18628 | }; |
| 18629 | |
| 18630 | |
| 18631 | /* |
| 18632 | * BIOS auto configuration |
| 18633 | */ |
| 18634 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18635 | /* convert from MIX nid to DAC */ |
| 18636 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 18637 | { |
| 18638 | if (nid == 0x0f) |
| 18639 | return 0x02; |
| 18640 | else if (nid >= 0x0c && nid <= 0x0e) |
| 18641 | return nid - 0x0c + 0x02; |
| 18642 | else |
| 18643 | return 0; |
| 18644 | } |
| 18645 | |
| 18646 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 18647 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 18648 | hda_nid_t dac) |
| 18649 | { |
| 18650 | hda_nid_t mix[4]; |
| 18651 | int i, num; |
| 18652 | |
| 18653 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18654 | for (i = 0; i < num; i++) { |
| 18655 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 18656 | return mix[i]; |
| 18657 | } |
| 18658 | return 0; |
| 18659 | } |
| 18660 | |
| 18661 | /* look for an empty DAC slot */ |
| 18662 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 18663 | { |
| 18664 | struct alc_spec *spec = codec->spec; |
| 18665 | hda_nid_t srcs[5]; |
| 18666 | int i, j, num; |
| 18667 | |
| 18668 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 18669 | if (num < 0) |
| 18670 | return 0; |
| 18671 | for (i = 0; i < num; i++) { |
| 18672 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 18673 | if (!nid) |
| 18674 | continue; |
| 18675 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 18676 | if (spec->multiout.dac_nids[j] == nid) |
| 18677 | break; |
| 18678 | if (j >= spec->multiout.num_dacs) |
| 18679 | return nid; |
| 18680 | } |
| 18681 | return 0; |
| 18682 | } |
| 18683 | |
| 18684 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 18685 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 18686 | const struct auto_pin_cfg *cfg) |
| 18687 | { |
| 18688 | struct alc_spec *spec = codec->spec; |
| 18689 | int i; |
| 18690 | hda_nid_t dac; |
| 18691 | |
| 18692 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 18693 | for (i = 0; i < cfg->line_outs; i++) { |
| 18694 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 18695 | if (!dac) |
| 18696 | continue; |
| 18697 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 18698 | } |
| 18699 | return 0; |
| 18700 | } |
| 18701 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18702 | static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18703 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18704 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18705 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18706 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 18707 | } |
| 18708 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18709 | static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18710 | hda_nid_t nid, unsigned int chs) |
| 18711 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18712 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18713 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 18714 | } |
| 18715 | |
| 18716 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 18717 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 18718 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 18719 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 18720 | |
| 18721 | /* add playback controls from the parsed DAC table */ |
| 18722 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 18723 | const struct auto_pin_cfg *cfg) |
| 18724 | { |
| 18725 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18726 | static const char *chname[4] = { |
| 18727 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 18728 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18729 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18730 | int i, err; |
| 18731 | |
| 18732 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18733 | nid = spec->multiout.dac_nids[i]; |
| 18734 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18735 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18736 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 18737 | if (!mix) |
| 18738 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18739 | if (i == 2) { |
| 18740 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18741 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18742 | if (err < 0) |
| 18743 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18744 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18745 | if (err < 0) |
| 18746 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18747 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18748 | if (err < 0) |
| 18749 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18750 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18751 | if (err < 0) |
| 18752 | return err; |
| 18753 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18754 | const char *pfx; |
| 18755 | if (cfg->line_outs == 1 && |
| 18756 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18757 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18758 | pfx = "Speaker"; |
| 18759 | else |
| 18760 | pfx = "PCM"; |
| 18761 | } else |
| 18762 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18763 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18764 | if (err < 0) |
| 18765 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18766 | if (cfg->line_outs == 1 && |
| 18767 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 18768 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18769 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18770 | if (err < 0) |
| 18771 | return err; |
| 18772 | } |
| 18773 | } |
| 18774 | return 0; |
| 18775 | } |
| 18776 | |
| 18777 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18778 | /* return DAC nid if any new DAC is assigned */ |
| 18779 | 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] | 18780 | const char *pfx) |
| 18781 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18782 | struct alc_spec *spec = codec->spec; |
| 18783 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18784 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18785 | |
| 18786 | if (!pin) |
| 18787 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18788 | nid = alc662_look_for_dac(codec, pin); |
| 18789 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18790 | /* the corresponding DAC is already occupied */ |
| 18791 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 18792 | return 0; /* no way */ |
| 18793 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18794 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18795 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 18796 | } |
| 18797 | |
| 18798 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 18799 | if (!mix) |
| 18800 | return 0; |
| 18801 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 18802 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 18803 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18804 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 18805 | if (err < 0) |
| 18806 | return err; |
| 18807 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18808 | } |
| 18809 | |
| 18810 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18811 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 18812 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18813 | |
| 18814 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 18815 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18816 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18817 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18818 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 18819 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18820 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18821 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18822 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18823 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 18824 | if (num <= 1) |
| 18825 | return; |
| 18826 | for (i = 0; i < num; i++) { |
| 18827 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 18828 | continue; |
| 18829 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 18830 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18831 | } |
| 18832 | } |
| 18833 | |
| 18834 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 18835 | { |
| 18836 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18837 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18838 | int i; |
| 18839 | |
| 18840 | for (i = 0; i <= HDA_SIDE; i++) { |
| 18841 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 18842 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 18843 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18844 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18845 | } |
| 18846 | } |
| 18847 | |
| 18848 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 18849 | { |
| 18850 | struct alc_spec *spec = codec->spec; |
| 18851 | hda_nid_t pin; |
| 18852 | |
| 18853 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18854 | if (pin) |
| 18855 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 18856 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18857 | pin = spec->autocfg.speaker_pins[0]; |
| 18858 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18859 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 18860 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18861 | } |
| 18862 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18863 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 18864 | |
| 18865 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 18866 | { |
| 18867 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 18868 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18869 | int i; |
| 18870 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 18871 | for (i = 0; i < cfg->num_inputs; i++) { |
| 18872 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18873 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 18874 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 18875 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 18876 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18877 | snd_hda_codec_write(codec, nid, 0, |
| 18878 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 18879 | AMP_OUT_MUTE); |
| 18880 | } |
| 18881 | } |
| 18882 | } |
| 18883 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18884 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 18885 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18886 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 18887 | { |
| 18888 | struct alc_spec *spec = codec->spec; |
| 18889 | int err; |
| 18890 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 18891 | |
| 18892 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 18893 | alc662_ignore); |
| 18894 | if (err < 0) |
| 18895 | return err; |
| 18896 | if (!spec->autocfg.line_outs) |
| 18897 | return 0; /* can't find valid BIOS pin config */ |
| 18898 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18899 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18900 | if (err < 0) |
| 18901 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18902 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18903 | if (err < 0) |
| 18904 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18905 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18906 | spec->autocfg.speaker_pins[0], |
| 18907 | "Speaker"); |
| 18908 | if (err < 0) |
| 18909 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18910 | if (err) |
| 18911 | spec->multiout.extra_out_nid[0] = err; |
| 18912 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18913 | "Headphone"); |
| 18914 | if (err < 0) |
| 18915 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18916 | if (err) |
| 18917 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18918 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18919 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18920 | return err; |
| 18921 | |
| 18922 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 18923 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 18924 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18925 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 18926 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 18927 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18928 | |
| 18929 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 18930 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 18931 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18932 | add_verb(spec, alc662_init_verbs); |
| 18933 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 18934 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18935 | add_verb(spec, alc663_init_verbs); |
| 18936 | |
| 18937 | if (codec->vendor_id == 0x10ec0272) |
| 18938 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 18939 | |
| 18940 | err = alc_auto_add_mic_boost(codec); |
| 18941 | if (err < 0) |
| 18942 | return err; |
| 18943 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18944 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 18945 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 18946 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 18947 | else |
| 18948 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 18949 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18950 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18951 | } |
| 18952 | |
| 18953 | /* additional initialization for auto-configuration model */ |
| 18954 | static void alc662_auto_init(struct hda_codec *codec) |
| 18955 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18956 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18957 | alc662_auto_init_multi_out(codec); |
| 18958 | alc662_auto_init_hp_out(codec); |
| 18959 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18960 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 18961 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18962 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 18963 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18964 | } |
| 18965 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 18966 | enum { |
| 18967 | ALC662_FIXUP_IDEAPAD, |
| 18968 | }; |
| 18969 | |
| 18970 | static const struct alc_fixup alc662_fixups[] = { |
| 18971 | [ALC662_FIXUP_IDEAPAD] = { |
| 18972 | .pins = (const struct alc_pincfg[]) { |
| 18973 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 18974 | { } |
| 18975 | } |
| 18976 | }, |
| 18977 | }; |
| 18978 | |
| 18979 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
| 18980 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
| 18981 | {} |
| 18982 | }; |
| 18983 | |
| 18984 | |
| 18985 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18986 | static int patch_alc662(struct hda_codec *codec) |
| 18987 | { |
| 18988 | struct alc_spec *spec; |
| 18989 | int err, board_config; |
| 18990 | |
| 18991 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 18992 | if (!spec) |
| 18993 | return -ENOMEM; |
| 18994 | |
| 18995 | codec->spec = spec; |
| 18996 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 18997 | alc_auto_parse_customize_define(codec); |
| 18998 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 18999 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19000 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19001 | if (alc_read_coef_idx(codec, 0) == 0x8020) |
| 19002 | alc_codec_rename(codec, "ALC661"); |
| 19003 | else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) && |
| 19004 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19005 | spec->cdefine.platform_type == 1) |
| 19006 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19007 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19008 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19009 | alc662_models, |
| 19010 | alc662_cfg_tbl); |
| 19011 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19012 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19013 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19014 | board_config = ALC662_AUTO; |
| 19015 | } |
| 19016 | |
| 19017 | if (board_config == ALC662_AUTO) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19018 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19019 | /* automatic parse from the BIOS config */ |
| 19020 | err = alc662_parse_auto_config(codec); |
| 19021 | if (err < 0) { |
| 19022 | alc_free(codec); |
| 19023 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19024 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19025 | printk(KERN_INFO |
| 19026 | "hda_codec: Cannot set up configuration " |
| 19027 | "from BIOS. Using base mode...\n"); |
| 19028 | board_config = ALC662_3ST_2ch_DIG; |
| 19029 | } |
| 19030 | } |
| 19031 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19032 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19033 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19034 | if (err < 0) { |
| 19035 | alc_free(codec); |
| 19036 | return err; |
| 19037 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19038 | } |
| 19039 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19040 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19041 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19042 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19043 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19044 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19045 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19046 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19047 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19048 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19049 | if (!spec->adc_nids) { |
| 19050 | spec->adc_nids = alc662_adc_nids; |
| 19051 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19052 | } |
| 19053 | if (!spec->capsrc_nids) |
| 19054 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19055 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19056 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19057 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19058 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19059 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19060 | switch (codec->vendor_id) { |
| 19061 | case 0x10ec0662: |
| 19062 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19063 | break; |
| 19064 | case 0x10ec0272: |
| 19065 | case 0x10ec0663: |
| 19066 | case 0x10ec0665: |
| 19067 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19068 | break; |
| 19069 | case 0x10ec0273: |
| 19070 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19071 | break; |
| 19072 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19073 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19074 | spec->vmaster_nid = 0x02; |
| 19075 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19076 | codec->patch_ops = alc_patch_ops; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19077 | if (board_config == ALC662_AUTO) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19078 | spec->init_hook = alc662_auto_init; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19079 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 0); |
| 19080 | } |
| 19081 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19082 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19083 | if (!spec->loopback.amplist) |
| 19084 | spec->loopback.amplist = alc662_loopbacks; |
| 19085 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19086 | |
| 19087 | return 0; |
| 19088 | } |
| 19089 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19090 | static int patch_alc888(struct hda_codec *codec) |
| 19091 | { |
| 19092 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19093 | kfree(codec->chip_name); |
| 19094 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19095 | if (!codec->chip_name) { |
| 19096 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19097 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19098 | } |
| 19099 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19100 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19101 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19102 | } |
| 19103 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19104 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19105 | * ALC680 support |
| 19106 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19107 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19108 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19109 | #define alc680_modes alc260_modes |
| 19110 | |
| 19111 | static hda_nid_t alc680_dac_nids[3] = { |
| 19112 | /* Lout1, Lout2, hp */ |
| 19113 | 0x02, 0x03, 0x04 |
| 19114 | }; |
| 19115 | |
| 19116 | static hda_nid_t alc680_adc_nids[3] = { |
| 19117 | /* ADC0-2 */ |
| 19118 | /* DMIC, MIC, Line-in*/ |
| 19119 | 0x07, 0x08, 0x09 |
| 19120 | }; |
| 19121 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19122 | /* |
| 19123 | * Analog capture ADC cgange |
| 19124 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19125 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19126 | { |
| 19127 | struct alc_spec *spec = codec->spec; |
| 19128 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19129 | int pin_found = 0; |
| 19130 | int type_found = AUTO_PIN_LAST; |
| 19131 | hda_nid_t nid; |
| 19132 | int i; |
| 19133 | |
| 19134 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19135 | nid = cfg->inputs[i].pin; |
| 19136 | if (!(snd_hda_query_pin_caps(codec, nid) & |
| 19137 | AC_PINCAP_PRES_DETECT)) |
| 19138 | continue; |
| 19139 | if (snd_hda_jack_detect(codec, nid)) { |
| 19140 | if (cfg->inputs[i].type < type_found) { |
| 19141 | type_found = cfg->inputs[i].type; |
| 19142 | pin_found = nid; |
| 19143 | } |
| 19144 | } |
| 19145 | } |
| 19146 | |
| 19147 | nid = 0x07; |
| 19148 | if (pin_found) |
| 19149 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19150 | |
| 19151 | if (nid != spec->cur_adc) |
| 19152 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19153 | spec->cur_adc = nid; |
| 19154 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19155 | spec->cur_adc_format); |
| 19156 | } |
| 19157 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19158 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19159 | struct hda_codec *codec, |
| 19160 | unsigned int stream_tag, |
| 19161 | unsigned int format, |
| 19162 | struct snd_pcm_substream *substream) |
| 19163 | { |
| 19164 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19165 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19166 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19167 | spec->cur_adc_stream_tag = stream_tag; |
| 19168 | spec->cur_adc_format = format; |
| 19169 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19170 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19171 | return 0; |
| 19172 | } |
| 19173 | |
| 19174 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19175 | struct hda_codec *codec, |
| 19176 | struct snd_pcm_substream *substream) |
| 19177 | { |
| 19178 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19179 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19180 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19181 | return 0; |
| 19182 | } |
| 19183 | |
| 19184 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
| 19185 | .substreams = 1, /* can be overridden */ |
| 19186 | .channels_min = 2, |
| 19187 | .channels_max = 2, |
| 19188 | /* NID is set in alc_build_pcms */ |
| 19189 | .ops = { |
| 19190 | .prepare = alc680_capture_pcm_prepare, |
| 19191 | .cleanup = alc680_capture_pcm_cleanup |
| 19192 | }, |
| 19193 | }; |
| 19194 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19195 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19196 | /* output mixer control */ |
| 19197 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19198 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19199 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19200 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19201 | HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19202 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19203 | HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19204 | { } |
| 19205 | }; |
| 19206 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19207 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
| 19208 | .ops = &snd_hda_bind_vol, |
| 19209 | .values = { |
| 19210 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19211 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19212 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19213 | 0 |
| 19214 | }, |
| 19215 | }; |
| 19216 | |
| 19217 | static struct hda_bind_ctls alc680_bind_cap_switch = { |
| 19218 | .ops = &snd_hda_bind_sw, |
| 19219 | .values = { |
| 19220 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19221 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19222 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19223 | 0 |
| 19224 | }, |
| 19225 | }; |
| 19226 | |
| 19227 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
| 19228 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19229 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19230 | { } /* end */ |
| 19231 | }; |
| 19232 | |
| 19233 | /* |
| 19234 | * generic initialization of ADC, input mixers and output mixers |
| 19235 | */ |
| 19236 | static struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19237 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19238 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19239 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19240 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19241 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19242 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19243 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19244 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19245 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19246 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19247 | |
| 19248 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19249 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19250 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19251 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19252 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19253 | |
| 19254 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19255 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19256 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19257 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19258 | { } |
| 19259 | }; |
| 19260 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19261 | /* toggle speaker-output according to the hp-jack state */ |
| 19262 | static void alc680_base_setup(struct hda_codec *codec) |
| 19263 | { |
| 19264 | struct alc_spec *spec = codec->spec; |
| 19265 | |
| 19266 | spec->autocfg.hp_pins[0] = 0x16; |
| 19267 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19268 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19269 | spec->autocfg.num_inputs = 2; |
| 19270 | spec->autocfg.inputs[0].pin = 0x18; |
| 19271 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19272 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame^] | 19273 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19274 | } |
| 19275 | |
| 19276 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19277 | unsigned int res) |
| 19278 | { |
| 19279 | if ((res >> 26) == ALC880_HP_EVENT) |
| 19280 | alc_automute_amp(codec); |
| 19281 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19282 | alc680_rec_autoswitch(codec); |
| 19283 | } |
| 19284 | |
| 19285 | static void alc680_inithook(struct hda_codec *codec) |
| 19286 | { |
| 19287 | alc_automute_amp(codec); |
| 19288 | alc680_rec_autoswitch(codec); |
| 19289 | } |
| 19290 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19291 | /* create input playback/capture controls for the given pin */ |
| 19292 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19293 | const char *ctlname, int idx) |
| 19294 | { |
| 19295 | hda_nid_t dac; |
| 19296 | int err; |
| 19297 | |
| 19298 | switch (nid) { |
| 19299 | case 0x14: |
| 19300 | dac = 0x02; |
| 19301 | break; |
| 19302 | case 0x15: |
| 19303 | dac = 0x03; |
| 19304 | break; |
| 19305 | case 0x16: |
| 19306 | dac = 0x04; |
| 19307 | break; |
| 19308 | default: |
| 19309 | return 0; |
| 19310 | } |
| 19311 | if (spec->multiout.dac_nids[0] != dac && |
| 19312 | spec->multiout.dac_nids[1] != dac) { |
| 19313 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19314 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19315 | HDA_OUTPUT)); |
| 19316 | if (err < 0) |
| 19317 | return err; |
| 19318 | |
| 19319 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19320 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19321 | |
| 19322 | if (err < 0) |
| 19323 | return err; |
| 19324 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19325 | } |
| 19326 | |
| 19327 | return 0; |
| 19328 | } |
| 19329 | |
| 19330 | /* add playback controls from the parsed DAC table */ |
| 19331 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19332 | const struct auto_pin_cfg *cfg) |
| 19333 | { |
| 19334 | hda_nid_t nid; |
| 19335 | int err; |
| 19336 | |
| 19337 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19338 | |
| 19339 | nid = cfg->line_out_pins[0]; |
| 19340 | if (nid) { |
| 19341 | const char *name; |
| 19342 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19343 | name = "Speaker"; |
| 19344 | else |
| 19345 | name = "Front"; |
| 19346 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19347 | if (err < 0) |
| 19348 | return err; |
| 19349 | } |
| 19350 | |
| 19351 | nid = cfg->speaker_pins[0]; |
| 19352 | if (nid) { |
| 19353 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19354 | if (err < 0) |
| 19355 | return err; |
| 19356 | } |
| 19357 | nid = cfg->hp_pins[0]; |
| 19358 | if (nid) { |
| 19359 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19360 | if (err < 0) |
| 19361 | return err; |
| 19362 | } |
| 19363 | |
| 19364 | return 0; |
| 19365 | } |
| 19366 | |
| 19367 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19368 | hda_nid_t nid, int pin_type) |
| 19369 | { |
| 19370 | alc_set_pin_output(codec, nid, pin_type); |
| 19371 | } |
| 19372 | |
| 19373 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19374 | { |
| 19375 | struct alc_spec *spec = codec->spec; |
| 19376 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19377 | if (nid) { |
| 19378 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19379 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19380 | } |
| 19381 | } |
| 19382 | |
| 19383 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19384 | { |
| 19385 | struct alc_spec *spec = codec->spec; |
| 19386 | hda_nid_t pin; |
| 19387 | |
| 19388 | pin = spec->autocfg.hp_pins[0]; |
| 19389 | if (pin) |
| 19390 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19391 | pin = spec->autocfg.speaker_pins[0]; |
| 19392 | if (pin) |
| 19393 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19394 | } |
| 19395 | |
| 19396 | /* pcm configuration: identical with ALC880 */ |
| 19397 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19398 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19399 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19400 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19401 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19402 | |
| 19403 | /* |
| 19404 | * BIOS auto configuration |
| 19405 | */ |
| 19406 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19407 | { |
| 19408 | struct alc_spec *spec = codec->spec; |
| 19409 | int err; |
| 19410 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19411 | |
| 19412 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19413 | alc680_ignore); |
| 19414 | if (err < 0) |
| 19415 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19416 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19417 | if (!spec->autocfg.line_outs) { |
| 19418 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19419 | spec->multiout.max_channels = 2; |
| 19420 | spec->no_analog = 1; |
| 19421 | goto dig_only; |
| 19422 | } |
| 19423 | return 0; /* can't find valid BIOS pin config */ |
| 19424 | } |
| 19425 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19426 | if (err < 0) |
| 19427 | return err; |
| 19428 | |
| 19429 | spec->multiout.max_channels = 2; |
| 19430 | |
| 19431 | dig_only: |
| 19432 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19433 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19434 | if (spec->kctls.list) |
| 19435 | add_mixer(spec, spec->kctls.list); |
| 19436 | |
| 19437 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19438 | |
| 19439 | err = alc_auto_add_mic_boost(codec); |
| 19440 | if (err < 0) |
| 19441 | return err; |
| 19442 | |
| 19443 | return 1; |
| 19444 | } |
| 19445 | |
| 19446 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19447 | |
| 19448 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19449 | static void alc680_auto_init(struct hda_codec *codec) |
| 19450 | { |
| 19451 | struct alc_spec *spec = codec->spec; |
| 19452 | alc680_auto_init_multi_out(codec); |
| 19453 | alc680_auto_init_hp_out(codec); |
| 19454 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19455 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19456 | if (spec->unsol_event) |
| 19457 | alc_inithook(codec); |
| 19458 | } |
| 19459 | |
| 19460 | /* |
| 19461 | * configuration and preset |
| 19462 | */ |
| 19463 | static const char *alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19464 | [ALC680_BASE] = "base", |
| 19465 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19466 | }; |
| 19467 | |
| 19468 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 19469 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19470 | {} |
| 19471 | }; |
| 19472 | |
| 19473 | static struct alc_config_preset alc680_presets[] = { |
| 19474 | [ALC680_BASE] = { |
| 19475 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19476 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19477 | .init_verbs = { alc680_init_verbs }, |
| 19478 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19479 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19480 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19481 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19482 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19483 | .unsol_event = alc680_unsol_event, |
| 19484 | .setup = alc680_base_setup, |
| 19485 | .init_hook = alc680_inithook, |
| 19486 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19487 | }, |
| 19488 | }; |
| 19489 | |
| 19490 | static int patch_alc680(struct hda_codec *codec) |
| 19491 | { |
| 19492 | struct alc_spec *spec; |
| 19493 | int board_config; |
| 19494 | int err; |
| 19495 | |
| 19496 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19497 | if (spec == NULL) |
| 19498 | return -ENOMEM; |
| 19499 | |
| 19500 | codec->spec = spec; |
| 19501 | |
| 19502 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 19503 | alc680_models, |
| 19504 | alc680_cfg_tbl); |
| 19505 | |
| 19506 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 19507 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19508 | codec->chip_name); |
| 19509 | board_config = ALC680_AUTO; |
| 19510 | } |
| 19511 | |
| 19512 | if (board_config == ALC680_AUTO) { |
| 19513 | /* automatic parse from the BIOS config */ |
| 19514 | err = alc680_parse_auto_config(codec); |
| 19515 | if (err < 0) { |
| 19516 | alc_free(codec); |
| 19517 | return err; |
| 19518 | } else if (!err) { |
| 19519 | printk(KERN_INFO |
| 19520 | "hda_codec: Cannot set up configuration " |
| 19521 | "from BIOS. Using base mode...\n"); |
| 19522 | board_config = ALC680_BASE; |
| 19523 | } |
| 19524 | } |
| 19525 | |
| 19526 | if (board_config != ALC680_AUTO) |
| 19527 | setup_preset(codec, &alc680_presets[board_config]); |
| 19528 | |
| 19529 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19530 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19531 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19532 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19533 | |
| 19534 | if (!spec->adc_nids) { |
| 19535 | spec->adc_nids = alc680_adc_nids; |
| 19536 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 19537 | } |
| 19538 | |
| 19539 | if (!spec->cap_mixer) |
| 19540 | set_capture_mixer(codec); |
| 19541 | |
| 19542 | spec->vmaster_nid = 0x02; |
| 19543 | |
| 19544 | codec->patch_ops = alc_patch_ops; |
| 19545 | if (board_config == ALC680_AUTO) |
| 19546 | spec->init_hook = alc680_auto_init; |
| 19547 | |
| 19548 | return 0; |
| 19549 | } |
| 19550 | |
| 19551 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19552 | * patch entries |
| 19553 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19554 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19555 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19556 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19557 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 19558 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19559 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19560 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 19561 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19562 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19563 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19564 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19565 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 19566 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 19567 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19568 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19569 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19570 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 19571 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 19572 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19573 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19574 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19575 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19576 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19577 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19578 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 19579 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19580 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 19581 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19582 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19583 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19584 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 19585 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19586 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19587 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19588 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19589 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19590 | {} /* terminator */ |
| 19591 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19592 | |
| 19593 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 19594 | |
| 19595 | MODULE_LICENSE("GPL"); |
| 19596 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 19597 | |
| 19598 | static struct hda_codec_preset_list realtek_list = { |
| 19599 | .preset = snd_hda_preset_realtek, |
| 19600 | .owner = THIS_MODULE, |
| 19601 | }; |
| 19602 | |
| 19603 | static int __init patch_realtek_init(void) |
| 19604 | { |
| 19605 | return snd_hda_add_codec_preset(&realtek_list); |
| 19606 | } |
| 19607 | |
| 19608 | static void __exit patch_realtek_exit(void) |
| 19609 | { |
| 19610 | snd_hda_delete_codec_preset(&realtek_list); |
| 19611 | } |
| 19612 | |
| 19613 | module_init(patch_realtek_init) |
| 19614 | module_exit(patch_realtek_exit) |