Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 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 | 7cf51e48 | 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 | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 140 | ALC269_AUTO, |
| 141 | ALC269_MODEL_LAST /* last tag */ |
| 142 | }; |
| 143 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 144 | /* ALC861 models */ |
| 145 | enum { |
| 146 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 147 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 148 | ALC861_3ST_DIG, |
| 149 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 150 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 151 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 152 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 153 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 154 | ALC861_AUTO, |
| 155 | ALC861_MODEL_LAST, |
| 156 | }; |
| 157 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 158 | /* ALC861-VD models */ |
| 159 | enum { |
| 160 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 161 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 162 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 163 | ALC861VD_3ST, |
| 164 | ALC861VD_3ST_DIG, |
| 165 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 166 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 167 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 168 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 169 | ALC861VD_AUTO, |
| 170 | ALC861VD_MODEL_LAST, |
| 171 | }; |
| 172 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 173 | /* ALC662 models */ |
| 174 | enum { |
| 175 | ALC662_3ST_2ch_DIG, |
| 176 | ALC662_3ST_6ch_DIG, |
| 177 | ALC662_3ST_6ch, |
| 178 | ALC662_5ST_DIG, |
| 179 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 180 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 181 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 182 | ALC663_ASUS_M51VA, |
| 183 | ALC663_ASUS_G71V, |
| 184 | ALC663_ASUS_H13, |
| 185 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 186 | ALC662_ECS, |
| 187 | ALC663_ASUS_MODE1, |
| 188 | ALC662_ASUS_MODE2, |
| 189 | ALC663_ASUS_MODE3, |
| 190 | ALC663_ASUS_MODE4, |
| 191 | ALC663_ASUS_MODE5, |
| 192 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 193 | ALC663_ASUS_MODE7, |
| 194 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 195 | ALC272_DELL, |
| 196 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 197 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 198 | ALC662_AUTO, |
| 199 | ALC662_MODEL_LAST, |
| 200 | }; |
| 201 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 202 | /* ALC882 models */ |
| 203 | enum { |
| 204 | ALC882_3ST_DIG, |
| 205 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 206 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 207 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 208 | ALC882_TARGA, |
| 209 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 210 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 211 | ALC885_MACPRO, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 212 | ALC885_MBA21, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 213 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 214 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 215 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 216 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 217 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 218 | ALC883_3ST_2ch_DIG, |
| 219 | ALC883_3ST_6ch_DIG, |
| 220 | ALC883_3ST_6ch, |
| 221 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 222 | ALC883_TARGA_DIG, |
| 223 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 224 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 225 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 226 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 227 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 228 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 231 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 232 | ALC883_MEDION_MD2, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 233 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 234 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 235 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 236 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 237 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 238 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 239 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 240 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 241 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 242 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 243 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 244 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 245 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 246 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 247 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 248 | ALC889A_INTEL, |
| 249 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 250 | ALC888_ASUS_M90V, |
| 251 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 252 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 253 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 254 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 255 | ALC882_AUTO, |
| 256 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 257 | }; |
| 258 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 259 | /* for GPIO Poll */ |
| 260 | #define GPIO_MASK 0x03 |
| 261 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 262 | /* extra amp-initialization sequence types */ |
| 263 | enum { |
| 264 | ALC_INIT_NONE, |
| 265 | ALC_INIT_DEFAULT, |
| 266 | ALC_INIT_GPIO1, |
| 267 | ALC_INIT_GPIO2, |
| 268 | ALC_INIT_GPIO3, |
| 269 | }; |
| 270 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 271 | struct alc_mic_route { |
| 272 | hda_nid_t pin; |
| 273 | unsigned char mux_idx; |
| 274 | unsigned char amix_idx; |
| 275 | }; |
| 276 | |
| 277 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 278 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | struct alc_spec { |
| 280 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 281 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 283 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 284 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 286 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 287 | * don't forget NULL |
| 288 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 289 | */ |
| 290 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 291 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 292 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | struct hda_pcm_stream *stream_analog_playback; |
| 294 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 295 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 296 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 298 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | struct hda_pcm_stream *stream_digital_playback; |
| 300 | struct hda_pcm_stream *stream_digital_capture; |
| 301 | |
| 302 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 303 | struct hda_multi_out multiout; /* playback set-up |
| 304 | * max_channels, dacs must be set |
| 305 | * dig_out_nid and hp_nid are optional |
| 306 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 307 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 308 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 309 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | |
| 311 | /* capture */ |
| 312 | unsigned int num_adc_nids; |
| 313 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 314 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 315 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | |
| 317 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 318 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | const struct hda_input_mux *input_mux; |
| 320 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 321 | struct alc_mic_route ext_mic; |
| 322 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | |
| 324 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 325 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 327 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 328 | int const_channel_count; |
| 329 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | |
| 331 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 332 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 333 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 334 | /* dynamic controls, init_verbs and input_mux */ |
| 335 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 336 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 337 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 338 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 339 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 340 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 341 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 342 | /* hooks */ |
| 343 | void (*init_hook)(struct hda_codec *codec); |
| 344 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 345 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 346 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 347 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 348 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 349 | /* for pin sensing */ |
| 350 | unsigned int sense_updated: 1; |
| 351 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 352 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 353 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 354 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 355 | /* other flags */ |
| 356 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 357 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 358 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 359 | /* for virtual master */ |
| 360 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 361 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 362 | struct hda_loopback_check loopback; |
| 363 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 364 | |
| 365 | /* for PLL fix */ |
| 366 | hda_nid_t pll_nid; |
| 367 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 368 | }; |
| 369 | |
| 370 | /* |
| 371 | * configuration template - to be copied to the spec instance |
| 372 | */ |
| 373 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 374 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 375 | * with spec |
| 376 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 377 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 378 | const struct hda_verb *init_verbs[5]; |
| 379 | unsigned int num_dacs; |
| 380 | hda_nid_t *dac_nids; |
| 381 | hda_nid_t dig_out_nid; /* optional */ |
| 382 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 383 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 384 | unsigned int num_adc_nids; |
| 385 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 386 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 387 | hda_nid_t dig_in_nid; |
| 388 | unsigned int num_channel_mode; |
| 389 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 390 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 391 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 392 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 393 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 394 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 395 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 396 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 397 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 398 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 399 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 400 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 401 | }; |
| 402 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | |
| 404 | /* |
| 405 | * input MUX handling |
| 406 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 407 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 408 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 409 | { |
| 410 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 411 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 412 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 413 | if (mux_idx >= spec->num_mux_defs) |
| 414 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 415 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 416 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 417 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 418 | } |
| 419 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 420 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 421 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 422 | { |
| 423 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 424 | struct alc_spec *spec = codec->spec; |
| 425 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 426 | |
| 427 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 428 | return 0; |
| 429 | } |
| 430 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 431 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 432 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 433 | { |
| 434 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 435 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 436 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 437 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 438 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 439 | hda_nid_t nid = spec->capsrc_nids ? |
| 440 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 441 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 443 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 444 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 445 | if (!imux->num_items && mux_idx > 0) |
| 446 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 447 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 448 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 449 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 450 | /* Matrix-mixer style (e.g. ALC882) */ |
| 451 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 452 | unsigned int i, idx; |
| 453 | |
| 454 | idx = ucontrol->value.enumerated.item[0]; |
| 455 | if (idx >= imux->num_items) |
| 456 | idx = imux->num_items - 1; |
| 457 | if (*cur_val == idx) |
| 458 | return 0; |
| 459 | for (i = 0; i < imux->num_items; i++) { |
| 460 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 461 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 462 | imux->items[i].index, |
| 463 | HDA_AMP_MUTE, v); |
| 464 | } |
| 465 | *cur_val = idx; |
| 466 | return 1; |
| 467 | } else { |
| 468 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 469 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 470 | &spec->cur_mux[adc_idx]); |
| 471 | } |
| 472 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 473 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 474 | /* |
| 475 | * channel mode setting |
| 476 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 477 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 478 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 | { |
| 480 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 481 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 482 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 483 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 484 | } |
| 485 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 486 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 487 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 488 | { |
| 489 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 490 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 491 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 492 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 493 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | } |
| 495 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 496 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 497 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 | { |
| 499 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 500 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 501 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 502 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 503 | &spec->ext_channel_count); |
| 504 | if (err >= 0 && !spec->const_channel_count) { |
| 505 | spec->multiout.max_channels = spec->ext_channel_count; |
| 506 | if (spec->need_dac_fix) |
| 507 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 508 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 509 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 510 | } |
| 511 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 512 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 513 | * 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] | 514 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 515 | * being part of a format specifier. Maximum allowed length of a value is |
| 516 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 517 | * |
| 518 | * Note: some retasking pin complexes seem to ignore requests for input |
| 519 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 520 | * are requested. Therefore order this list so that this behaviour will not |
| 521 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 522 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 523 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 524 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 525 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 526 | "Mic 50pc bias", "Mic 80pc bias", |
| 527 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 528 | }; |
| 529 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 530 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 531 | }; |
| 532 | /* 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] | 533 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 534 | * addition, "input" pins may or may not process the mic bias option |
| 535 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 536 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 537 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 538 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 539 | #define ALC_PIN_DIR_IN 0x00 |
| 540 | #define ALC_PIN_DIR_OUT 0x01 |
| 541 | #define ALC_PIN_DIR_INOUT 0x02 |
| 542 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 543 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 544 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 545 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 546 | * For each direction the minimum and maximum values are given. |
| 547 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 548 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 549 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 550 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 551 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 552 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 553 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 554 | }; |
| 555 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 556 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 557 | #define alc_pin_mode_n_items(_dir) \ |
| 558 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 559 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 560 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 561 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 562 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 563 | unsigned int item_num = uinfo->value.enumerated.item; |
| 564 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 565 | |
| 566 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 567 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 568 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 569 | |
| 570 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 571 | item_num = alc_pin_mode_min(dir); |
| 572 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 573 | return 0; |
| 574 | } |
| 575 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 576 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 577 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 578 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 579 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 580 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 581 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 582 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 583 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 584 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 585 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 586 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 587 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 588 | /* Find enumerated value for current pinctl setting */ |
| 589 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 590 | 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] | 591 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 592 | *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] | 593 | return 0; |
| 594 | } |
| 595 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 596 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 597 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 598 | { |
| 599 | signed int change; |
| 600 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 601 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 602 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 603 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 604 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 605 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 606 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 607 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 608 | 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] | 609 | val = alc_pin_mode_min(dir); |
| 610 | |
| 611 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 612 | if (change) { |
| 613 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 614 | snd_hda_codec_write_cache(codec, nid, 0, |
| 615 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 616 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 617 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 618 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 619 | * for the requested pin mode. Enum values of 2 or less are |
| 620 | * input modes. |
| 621 | * |
| 622 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 623 | * reduces noise slightly (particularly on input) so we'll |
| 624 | * do it. However, having both input and output buffers |
| 625 | * enabled simultaneously doesn't seem to be problematic if |
| 626 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 627 | */ |
| 628 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 629 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 630 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 631 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 632 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 633 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 634 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 635 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 636 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 637 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 638 | } |
| 639 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 640 | return change; |
| 641 | } |
| 642 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 643 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 644 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 645 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 646 | .info = alc_pin_mode_info, \ |
| 647 | .get = alc_pin_mode_get, \ |
| 648 | .put = alc_pin_mode_put, \ |
| 649 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 650 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 651 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 652 | * together using a mask with more than one bit set. This control is |
| 653 | * currently used only by the ALC260 test model. At this stage they are not |
| 654 | * needed for any "production" models. |
| 655 | */ |
| 656 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 657 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 658 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 659 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 660 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 661 | { |
| 662 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 663 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 664 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 665 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 666 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 667 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 668 | |
| 669 | *valp = (val & mask) != 0; |
| 670 | return 0; |
| 671 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 672 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 673 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 674 | { |
| 675 | signed int change; |
| 676 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 677 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 678 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 679 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 680 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 681 | AC_VERB_GET_GPIO_DATA, |
| 682 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 683 | |
| 684 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 685 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 686 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 687 | gpio_data &= ~mask; |
| 688 | else |
| 689 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 690 | snd_hda_codec_write_cache(codec, nid, 0, |
| 691 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 692 | |
| 693 | return change; |
| 694 | } |
| 695 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 696 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 697 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 698 | .info = alc_gpio_data_info, \ |
| 699 | .get = alc_gpio_data_get, \ |
| 700 | .put = alc_gpio_data_put, \ |
| 701 | .private_value = nid | (mask<<16) } |
| 702 | #endif /* CONFIG_SND_DEBUG */ |
| 703 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 704 | /* A switch control to allow the enabling of the digital IO pins on the |
| 705 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 706 | * to provide something in the test model allowing digital outputs to be |
| 707 | * identified if present. If models are found which can utilise these |
| 708 | * outputs a more complete mixer control can be devised for those models if |
| 709 | * necessary. |
| 710 | */ |
| 711 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 712 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 713 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 714 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 715 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 716 | { |
| 717 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 718 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 719 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 720 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 721 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 722 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 723 | |
| 724 | *valp = (val & mask) != 0; |
| 725 | return 0; |
| 726 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 727 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 728 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 729 | { |
| 730 | signed int change; |
| 731 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 732 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 733 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 734 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 735 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 736 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 737 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 738 | |
| 739 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 740 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 741 | if (val==0) |
| 742 | ctrl_data &= ~mask; |
| 743 | else |
| 744 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 745 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 746 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 747 | |
| 748 | return change; |
| 749 | } |
| 750 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 751 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 752 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 753 | .info = alc_spdif_ctrl_info, \ |
| 754 | .get = alc_spdif_ctrl_get, \ |
| 755 | .put = alc_spdif_ctrl_put, \ |
| 756 | .private_value = nid | (mask<<16) } |
| 757 | #endif /* CONFIG_SND_DEBUG */ |
| 758 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 759 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 760 | * Again, this is only used in the ALC26x test models to help identify when |
| 761 | * the EAPD line must be asserted for features to work. |
| 762 | */ |
| 763 | #ifdef CONFIG_SND_DEBUG |
| 764 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 765 | |
| 766 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 767 | struct snd_ctl_elem_value *ucontrol) |
| 768 | { |
| 769 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 770 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 771 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 772 | long *valp = ucontrol->value.integer.value; |
| 773 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 774 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 775 | |
| 776 | *valp = (val & mask) != 0; |
| 777 | return 0; |
| 778 | } |
| 779 | |
| 780 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 781 | struct snd_ctl_elem_value *ucontrol) |
| 782 | { |
| 783 | int change; |
| 784 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 785 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 786 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 787 | long val = *ucontrol->value.integer.value; |
| 788 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 789 | AC_VERB_GET_EAPD_BTLENABLE, |
| 790 | 0x00); |
| 791 | |
| 792 | /* Set/unset the masked control bit(s) as needed */ |
| 793 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 794 | if (!val) |
| 795 | ctrl_data &= ~mask; |
| 796 | else |
| 797 | ctrl_data |= mask; |
| 798 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 799 | ctrl_data); |
| 800 | |
| 801 | return change; |
| 802 | } |
| 803 | |
| 804 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 805 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 806 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 807 | .info = alc_eapd_ctrl_info, \ |
| 808 | .get = alc_eapd_ctrl_get, \ |
| 809 | .put = alc_eapd_ctrl_put, \ |
| 810 | .private_value = nid | (mask<<16) } |
| 811 | #endif /* CONFIG_SND_DEBUG */ |
| 812 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 813 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 814 | * set up the input pin config (depending on the given auto-pin type) |
| 815 | */ |
| 816 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 817 | int auto_pin_type) |
| 818 | { |
| 819 | unsigned int val = PIN_IN; |
| 820 | |
| 821 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 822 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 823 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 824 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 825 | if (pincap & AC_PINCAP_VREF_80) |
| 826 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 827 | else if (pincap & AC_PINCAP_VREF_50) |
| 828 | val = PIN_VREF50; |
| 829 | else if (pincap & AC_PINCAP_VREF_100) |
| 830 | val = PIN_VREF100; |
| 831 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 832 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 833 | } |
| 834 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 835 | } |
| 836 | |
| 837 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 838 | */ |
| 839 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 840 | { |
| 841 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 842 | return; |
| 843 | spec->mixers[spec->num_mixers++] = mix; |
| 844 | } |
| 845 | |
| 846 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 847 | { |
| 848 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 849 | return; |
| 850 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 851 | } |
| 852 | |
| 853 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 854 | * set up from the preset table |
| 855 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 856 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 857 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 858 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 859 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 860 | int i; |
| 861 | |
| 862 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 863 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 864 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 865 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 866 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 867 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 868 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 869 | spec->channel_mode = preset->channel_mode; |
| 870 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 871 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 872 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 873 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 874 | if (preset->const_channel_count) |
| 875 | spec->multiout.max_channels = preset->const_channel_count; |
| 876 | else |
| 877 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 878 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 879 | |
| 880 | spec->multiout.num_dacs = preset->num_dacs; |
| 881 | spec->multiout.dac_nids = preset->dac_nids; |
| 882 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 883 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 884 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 885 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 886 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 887 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 888 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 889 | spec->input_mux = preset->input_mux; |
| 890 | |
| 891 | spec->num_adc_nids = preset->num_adc_nids; |
| 892 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 893 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 894 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 895 | |
| 896 | spec->unsol_event = preset->unsol_event; |
| 897 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 898 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 899 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 900 | spec->loopback.amplist = preset->loopbacks; |
| 901 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 902 | |
| 903 | if (preset->setup) |
| 904 | preset->setup(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 905 | } |
| 906 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 907 | /* Enable GPIO mask and set output */ |
| 908 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 909 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 910 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 911 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 912 | { } |
| 913 | }; |
| 914 | |
| 915 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 916 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 917 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 918 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 919 | { } |
| 920 | }; |
| 921 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 922 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 923 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 924 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 925 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 926 | { } |
| 927 | }; |
| 928 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 929 | /* |
| 930 | * Fix hardware PLL issue |
| 931 | * On some codecs, the analog PLL gating control must be off while |
| 932 | * the default value is 1. |
| 933 | */ |
| 934 | static void alc_fix_pll(struct hda_codec *codec) |
| 935 | { |
| 936 | struct alc_spec *spec = codec->spec; |
| 937 | unsigned int val; |
| 938 | |
| 939 | if (!spec->pll_nid) |
| 940 | return; |
| 941 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 942 | spec->pll_coef_idx); |
| 943 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 944 | AC_VERB_GET_PROC_COEF, 0); |
| 945 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 946 | spec->pll_coef_idx); |
| 947 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 948 | val & ~(1 << spec->pll_coef_bit)); |
| 949 | } |
| 950 | |
| 951 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 952 | unsigned int coef_idx, unsigned int coef_bit) |
| 953 | { |
| 954 | struct alc_spec *spec = codec->spec; |
| 955 | spec->pll_nid = nid; |
| 956 | spec->pll_coef_idx = coef_idx; |
| 957 | spec->pll_coef_bit = coef_bit; |
| 958 | alc_fix_pll(codec); |
| 959 | } |
| 960 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 961 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 962 | { |
| 963 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 964 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 965 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 966 | |
Takashi Iwai | ad87c64 | 2009-11-02 14:23:15 +0100 | [diff] [blame] | 967 | if (!nid) |
| 968 | return; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 969 | spec->jack_present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 970 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 971 | nid = spec->autocfg.speaker_pins[i]; |
| 972 | if (!nid) |
| 973 | break; |
| 974 | snd_hda_codec_write(codec, nid, 0, |
| 975 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 976 | spec->jack_present ? 0 : PIN_OUT); |
| 977 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 978 | } |
| 979 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 980 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 981 | hda_nid_t nid) |
| 982 | { |
| 983 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 984 | int i, nums; |
| 985 | |
| 986 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 987 | for (i = 0; i < nums; i++) |
| 988 | if (conn[i] == nid) |
| 989 | return i; |
| 990 | return -1; |
| 991 | } |
| 992 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 993 | static void alc_mic_automute(struct hda_codec *codec) |
| 994 | { |
| 995 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 996 | struct alc_mic_route *dead, *alive; |
| 997 | unsigned int present, type; |
| 998 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 999 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1000 | if (!spec->auto_mic) |
| 1001 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1002 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1003 | return; |
| 1004 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1005 | return; |
| 1006 | |
| 1007 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1008 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1009 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1010 | if (present) { |
| 1011 | alive = &spec->ext_mic; |
| 1012 | dead = &spec->int_mic; |
| 1013 | } else { |
| 1014 | alive = &spec->int_mic; |
| 1015 | dead = &spec->ext_mic; |
| 1016 | } |
| 1017 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1018 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1019 | if (type == AC_WID_AUD_MIX) { |
| 1020 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1021 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1022 | alive->mux_idx, |
| 1023 | HDA_AMP_MUTE, 0); |
| 1024 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1025 | dead->mux_idx, |
| 1026 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1027 | } else { |
| 1028 | /* MUX style (e.g. ALC880) */ |
| 1029 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1030 | AC_VERB_SET_CONNECT_SEL, |
| 1031 | alive->mux_idx); |
| 1032 | } |
| 1033 | |
| 1034 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1035 | } |
| 1036 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1037 | /* unsolicited event for HP jack sensing */ |
| 1038 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1039 | { |
| 1040 | if (codec->vendor_id == 0x10ec0880) |
| 1041 | res >>= 28; |
| 1042 | else |
| 1043 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1044 | switch (res) { |
| 1045 | case ALC880_HP_EVENT: |
| 1046 | alc_automute_pin(codec); |
| 1047 | break; |
| 1048 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1049 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1050 | break; |
| 1051 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1052 | } |
| 1053 | |
| 1054 | static void alc_inithook(struct hda_codec *codec) |
| 1055 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1056 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1057 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1058 | } |
| 1059 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1060 | /* additional initialization for ALC888 variants */ |
| 1061 | static void alc888_coef_init(struct hda_codec *codec) |
| 1062 | { |
| 1063 | unsigned int tmp; |
| 1064 | |
| 1065 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1066 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1067 | 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] | 1068 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1069 | /* alc888S-VC */ |
| 1070 | snd_hda_codec_read(codec, 0x20, 0, |
| 1071 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1072 | else |
| 1073 | /* alc888-VB */ |
| 1074 | snd_hda_codec_read(codec, 0x20, 0, |
| 1075 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1076 | } |
| 1077 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1078 | static void alc889_coef_init(struct hda_codec *codec) |
| 1079 | { |
| 1080 | unsigned int tmp; |
| 1081 | |
| 1082 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1083 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1084 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1085 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1086 | } |
| 1087 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1088 | /* turn on/off EAPD control (only if available) */ |
| 1089 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1090 | { |
| 1091 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1092 | return; |
| 1093 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1094 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1095 | on ? 2 : 0); |
| 1096 | } |
| 1097 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1098 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1099 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1100 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1101 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1102 | switch (type) { |
| 1103 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1104 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1105 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1106 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1107 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1108 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1109 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1110 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1111 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1112 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1113 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1114 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1115 | set_eapd(codec, 0x0f, 1); |
| 1116 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1117 | break; |
| 1118 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1119 | case 0x10ec0267: |
| 1120 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1121 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1122 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1123 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1124 | case 0x10ec0660: |
| 1125 | case 0x10ec0662: |
| 1126 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1127 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1128 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1129 | set_eapd(codec, 0x14, 1); |
| 1130 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1131 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1132 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1133 | switch (codec->vendor_id) { |
| 1134 | case 0x10ec0260: |
| 1135 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1136 | AC_VERB_SET_COEF_INDEX, 7); |
| 1137 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1138 | AC_VERB_GET_PROC_COEF, 0); |
| 1139 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1140 | AC_VERB_SET_COEF_INDEX, 7); |
| 1141 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1142 | AC_VERB_SET_PROC_COEF, |
| 1143 | tmp | 0x2010); |
| 1144 | break; |
| 1145 | case 0x10ec0262: |
| 1146 | case 0x10ec0880: |
| 1147 | case 0x10ec0882: |
| 1148 | case 0x10ec0883: |
| 1149 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1150 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1151 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1152 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1153 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1154 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1155 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1156 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1157 | #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] | 1158 | case 0x10ec0267: |
| 1159 | case 0x10ec0268: |
| 1160 | snd_hda_codec_write(codec, 0x20, 0, |
| 1161 | AC_VERB_SET_COEF_INDEX, 7); |
| 1162 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1163 | AC_VERB_GET_PROC_COEF, 0); |
| 1164 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1165 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1166 | snd_hda_codec_write(codec, 0x20, 0, |
| 1167 | AC_VERB_SET_PROC_COEF, |
| 1168 | tmp | 0x3000); |
| 1169 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1170 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1171 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1172 | break; |
| 1173 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1174 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1175 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1176 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1177 | { |
| 1178 | struct alc_spec *spec = codec->spec; |
| 1179 | |
| 1180 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1181 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1182 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1183 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1184 | if (spec->autocfg.line_out_pins[0] && |
| 1185 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1186 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1187 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1188 | else |
| 1189 | return; |
| 1190 | } |
| 1191 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1192 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1193 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1194 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1195 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1196 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1197 | spec->unsol_event = alc_sku_unsol_event; |
| 1198 | } |
| 1199 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1200 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1201 | { |
| 1202 | struct alc_spec *spec = codec->spec; |
| 1203 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1204 | hda_nid_t fixed, ext; |
| 1205 | int i; |
| 1206 | |
| 1207 | /* there must be only two mic inputs exclusively */ |
| 1208 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) |
| 1209 | if (cfg->input_pins[i]) |
| 1210 | return; |
| 1211 | |
| 1212 | fixed = ext = 0; |
| 1213 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { |
| 1214 | hda_nid_t nid = cfg->input_pins[i]; |
| 1215 | unsigned int defcfg; |
| 1216 | if (!nid) |
| 1217 | return; |
| 1218 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1219 | switch (get_defcfg_connect(defcfg)) { |
| 1220 | case AC_JACK_PORT_FIXED: |
| 1221 | if (fixed) |
| 1222 | return; /* already occupied */ |
| 1223 | fixed = nid; |
| 1224 | break; |
| 1225 | case AC_JACK_PORT_COMPLEX: |
| 1226 | if (ext) |
| 1227 | return; /* already occupied */ |
| 1228 | ext = nid; |
| 1229 | break; |
| 1230 | default: |
| 1231 | return; /* invalid entry */ |
| 1232 | } |
| 1233 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1234 | if (!ext || !fixed) |
| 1235 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1236 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1237 | return; /* no unsol support */ |
| 1238 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1239 | ext, fixed); |
| 1240 | spec->ext_mic.pin = ext; |
| 1241 | spec->int_mic.pin = fixed; |
| 1242 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1243 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1244 | spec->auto_mic = 1; |
| 1245 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1246 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1247 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1248 | spec->unsol_event = alc_sku_unsol_event; |
| 1249 | } |
| 1250 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1251 | /* check subsystem ID and set up device-specific initialization; |
| 1252 | * return 1 if initialized, 0 if invalid SSID |
| 1253 | */ |
| 1254 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1255 | * 31 ~ 16 : Manufacture ID |
| 1256 | * 15 ~ 8 : SKU ID |
| 1257 | * 7 ~ 0 : Assembly ID |
| 1258 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1259 | */ |
| 1260 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1261 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1262 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1263 | { |
| 1264 | unsigned int ass, tmp, i; |
| 1265 | unsigned nid; |
| 1266 | struct alc_spec *spec = codec->spec; |
| 1267 | |
| 1268 | ass = codec->subsystem_id & 0xffff; |
| 1269 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1270 | goto do_sku; |
| 1271 | |
| 1272 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1273 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1274 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1275 | * 29~21 : reserve |
| 1276 | * 20 : PCBEEP input |
| 1277 | * 19~16 : Check sum (15:1) |
| 1278 | * 15~1 : Custom |
| 1279 | * 0 : override |
| 1280 | */ |
| 1281 | nid = 0x1d; |
| 1282 | if (codec->vendor_id == 0x10ec0260) |
| 1283 | nid = 0x17; |
| 1284 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1285 | snd_printd("realtek: No valid SSID, " |
| 1286 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1287 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1288 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1289 | return 0; |
| 1290 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1291 | return 0; |
| 1292 | |
| 1293 | /* check sum */ |
| 1294 | tmp = 0; |
| 1295 | for (i = 1; i < 16; i++) { |
| 1296 | if ((ass >> i) & 1) |
| 1297 | tmp++; |
| 1298 | } |
| 1299 | if (((ass >> 16) & 0xf) != tmp) |
| 1300 | return 0; |
| 1301 | do_sku: |
| 1302 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1303 | ass & 0xffff, codec->vendor_id); |
| 1304 | /* |
| 1305 | * 0 : override |
| 1306 | * 1 : Swap Jack |
| 1307 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1308 | * 3~5 : External Amplifier control |
| 1309 | * 7~6 : Reserved |
| 1310 | */ |
| 1311 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1312 | switch (tmp) { |
| 1313 | case 1: |
| 1314 | spec->init_amp = ALC_INIT_GPIO1; |
| 1315 | break; |
| 1316 | case 3: |
| 1317 | spec->init_amp = ALC_INIT_GPIO2; |
| 1318 | break; |
| 1319 | case 7: |
| 1320 | spec->init_amp = ALC_INIT_GPIO3; |
| 1321 | break; |
| 1322 | case 5: |
| 1323 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1324 | break; |
| 1325 | } |
| 1326 | |
| 1327 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1328 | * when the external headphone out jack is plugged" |
| 1329 | */ |
| 1330 | if (!(ass & 0x8000)) |
| 1331 | return 1; |
| 1332 | /* |
| 1333 | * 10~8 : Jack location |
| 1334 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1335 | * 14~13: Resvered |
| 1336 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1337 | * when the external headphone out jack is plugged" |
| 1338 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1339 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1340 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1341 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1342 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1343 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1344 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1345 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1346 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1347 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1348 | else if (tmp == 3) |
| 1349 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1350 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1351 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1352 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1353 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1354 | return 1; |
| 1355 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1356 | } |
| 1357 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1358 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1359 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1360 | return 1; |
| 1361 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1362 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1363 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1364 | hda_nid_t porta, hda_nid_t porte, |
| 1365 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1366 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1367 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1368 | struct alc_spec *spec = codec->spec; |
| 1369 | snd_printd("realtek: " |
| 1370 | "Enable default setup for auto mode as fallback\n"); |
| 1371 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1372 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1373 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1374 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1375 | } |
| 1376 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1377 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1378 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1379 | */ |
| 1380 | |
| 1381 | struct alc_pincfg { |
| 1382 | hda_nid_t nid; |
| 1383 | u32 val; |
| 1384 | }; |
| 1385 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1386 | struct alc_fixup { |
| 1387 | const struct alc_pincfg *pins; |
| 1388 | const struct hda_verb *verbs; |
| 1389 | }; |
| 1390 | |
| 1391 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1392 | const struct snd_pci_quirk *quirk, |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1393 | const struct alc_fixup *fix, |
| 1394 | int pre_init) |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1395 | { |
| 1396 | const struct alc_pincfg *cfg; |
| 1397 | |
| 1398 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1399 | if (!quirk) |
| 1400 | return; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1401 | fix += quirk->value; |
| 1402 | cfg = fix->pins; |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1403 | if (pre_init && cfg) { |
| 1404 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1405 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", |
| 1406 | codec->chip_name, quirk->name); |
| 1407 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1408 | for (; cfg->nid; cfg++) |
| 1409 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
| 1410 | } |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1411 | if (!pre_init && fix->verbs) { |
| 1412 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1413 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", |
| 1414 | codec->chip_name, quirk->name); |
| 1415 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1416 | add_verb(codec->spec, fix->verbs); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1417 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1418 | } |
| 1419 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1420 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1421 | unsigned int coef_idx) |
| 1422 | { |
| 1423 | unsigned int val; |
| 1424 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1425 | coef_idx); |
| 1426 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1427 | AC_VERB_GET_PROC_COEF, 0); |
| 1428 | return val; |
| 1429 | } |
| 1430 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1431 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1432 | * ALC888 |
| 1433 | */ |
| 1434 | |
| 1435 | /* |
| 1436 | * 2ch mode |
| 1437 | */ |
| 1438 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1439 | /* Mic-in jack as mic in */ |
| 1440 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1441 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1442 | /* Line-in jack as Line in */ |
| 1443 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1444 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1445 | /* Line-Out as Front */ |
| 1446 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1447 | { } /* end */ |
| 1448 | }; |
| 1449 | |
| 1450 | /* |
| 1451 | * 4ch mode |
| 1452 | */ |
| 1453 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1454 | /* Mic-in jack as mic in */ |
| 1455 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1456 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1457 | /* Line-in jack as Surround */ |
| 1458 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1459 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1460 | /* Line-Out as Front */ |
| 1461 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1462 | { } /* end */ |
| 1463 | }; |
| 1464 | |
| 1465 | /* |
| 1466 | * 6ch mode |
| 1467 | */ |
| 1468 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1469 | /* Mic-in jack as CLFE */ |
| 1470 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1471 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1472 | /* Line-in jack as Surround */ |
| 1473 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1474 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1475 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1476 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1477 | { } /* end */ |
| 1478 | }; |
| 1479 | |
| 1480 | /* |
| 1481 | * 8ch mode |
| 1482 | */ |
| 1483 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1484 | /* Mic-in jack as CLFE */ |
| 1485 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1486 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1487 | /* Line-in jack as Surround */ |
| 1488 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1489 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1490 | /* Line-Out as Side */ |
| 1491 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1492 | { } /* end */ |
| 1493 | }; |
| 1494 | |
| 1495 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1496 | { 2, alc888_4ST_ch2_intel_init }, |
| 1497 | { 4, alc888_4ST_ch4_intel_init }, |
| 1498 | { 6, alc888_4ST_ch6_intel_init }, |
| 1499 | { 8, alc888_4ST_ch8_intel_init }, |
| 1500 | }; |
| 1501 | |
| 1502 | /* |
| 1503 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1504 | */ |
| 1505 | |
| 1506 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1507 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1508 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1509 | /* Connect Internal HP to Front */ |
| 1510 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1511 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1512 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1513 | /* Connect Bass HP to Front */ |
| 1514 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1515 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1516 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1517 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1518 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1519 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1520 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1521 | /* Connect Mic jack to CLFE */ |
| 1522 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1523 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1524 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1525 | /* Connect Line-in jack to Surround */ |
| 1526 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1527 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1528 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1529 | /* Connect HP out jack to Front */ |
| 1530 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1531 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1532 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1533 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1534 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1535 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1536 | {} |
| 1537 | }; |
| 1538 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1539 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1540 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1541 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1542 | unsigned int mute; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1543 | hda_nid_t nid; |
| 1544 | int i; |
| 1545 | |
| 1546 | spec->jack_present = 0; |
| 1547 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1548 | nid = spec->autocfg.hp_pins[i]; |
| 1549 | if (!nid) |
| 1550 | break; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1551 | if (snd_hda_jack_detect(codec, nid)) { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1552 | spec->jack_present = 1; |
| 1553 | break; |
| 1554 | } |
| 1555 | } |
| 1556 | |
| 1557 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1558 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1559 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1560 | nid = spec->autocfg.speaker_pins[i]; |
| 1561 | if (!nid) |
| 1562 | break; |
| 1563 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1564 | HDA_AMP_MUTE, mute); |
| 1565 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1566 | } |
| 1567 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1568 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1569 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1570 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1571 | if (codec->vendor_id == 0x10ec0880) |
| 1572 | res >>= 28; |
| 1573 | else |
| 1574 | res >>= 26; |
| 1575 | if (res == ALC880_HP_EVENT) |
| 1576 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1577 | } |
| 1578 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1579 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1580 | { |
| 1581 | struct alc_spec *spec = codec->spec; |
| 1582 | |
| 1583 | spec->autocfg.hp_pins[0] = 0x15; |
| 1584 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1585 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1586 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1587 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1588 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1589 | } |
| 1590 | |
| 1591 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1592 | { |
| 1593 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1594 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1595 | } |
| 1596 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1597 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1598 | { |
| 1599 | struct alc_spec *spec = codec->spec; |
| 1600 | |
| 1601 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1602 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1603 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1604 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1605 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1606 | |
| 1607 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1608 | * ALC888 Acer Aspire 4930G model |
| 1609 | */ |
| 1610 | |
| 1611 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1612 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1613 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1614 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1615 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1616 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1617 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1618 | /* Connect Internal HP to front */ |
| 1619 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1620 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1621 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1622 | /* Connect HP out to front */ |
| 1623 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1624 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1625 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1626 | { } |
| 1627 | }; |
| 1628 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1629 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1630 | * ALC888 Acer Aspire 6530G model |
| 1631 | */ |
| 1632 | |
| 1633 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1634 | /* Route to built-in subwoofer as well as speakers */ |
| 1635 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1636 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1637 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1638 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1639 | /* Bias voltage on for external mic port */ |
| 1640 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1641 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1642 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1643 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1644 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1645 | /* Enable unsolicited event for HP jack */ |
| 1646 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1647 | /* Enable speaker output */ |
| 1648 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1649 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1650 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1651 | /* Enable headphone output */ |
| 1652 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1653 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1654 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1655 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1656 | { } |
| 1657 | }; |
| 1658 | |
| 1659 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1660 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1661 | */ |
| 1662 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1663 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1664 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1665 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1666 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1667 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1668 | /* Enable unsolicited event for HP jack */ |
| 1669 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1670 | /* Connect Internal Front to Front */ |
| 1671 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1672 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1673 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1674 | /* Connect Internal Rear to Rear */ |
| 1675 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1676 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1677 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1678 | /* Connect Internal CLFE to CLFE */ |
| 1679 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1680 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1681 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1682 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1683 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1684 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1685 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1686 | /* Enable all DACs */ |
| 1687 | /* DAC DISABLE/MUTE 1? */ |
| 1688 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1689 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1690 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1691 | /* DAC DISABLE/MUTE 2? */ |
| 1692 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1693 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1694 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1695 | /* DMIC fix |
| 1696 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1697 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1698 | * makes the signal become a difference/sum signal instead of standard |
| 1699 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1700 | * codec replicate the sum signal to both channels, turning it into a |
| 1701 | * normal mono mic. |
| 1702 | */ |
| 1703 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1704 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1705 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1706 | { } |
| 1707 | }; |
| 1708 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1709 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1710 | /* Front mic only available on one ADC */ |
| 1711 | { |
| 1712 | .num_items = 4, |
| 1713 | .items = { |
| 1714 | { "Mic", 0x0 }, |
| 1715 | { "Line", 0x2 }, |
| 1716 | { "CD", 0x4 }, |
| 1717 | { "Front Mic", 0xb }, |
| 1718 | }, |
| 1719 | }, |
| 1720 | { |
| 1721 | .num_items = 3, |
| 1722 | .items = { |
| 1723 | { "Mic", 0x0 }, |
| 1724 | { "Line", 0x2 }, |
| 1725 | { "CD", 0x4 }, |
| 1726 | }, |
| 1727 | } |
| 1728 | }; |
| 1729 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1730 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1731 | /* Interal mic only available on one ADC */ |
| 1732 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1733 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1734 | .items = { |
| 1735 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1736 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1737 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1738 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1739 | { "Int Mic", 0xb }, |
| 1740 | }, |
| 1741 | }, |
| 1742 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1743 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1744 | .items = { |
| 1745 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1746 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1747 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1748 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1749 | }, |
| 1750 | } |
| 1751 | }; |
| 1752 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1753 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1754 | /* Digital mic only available on first "ADC" */ |
| 1755 | { |
| 1756 | .num_items = 5, |
| 1757 | .items = { |
| 1758 | { "Mic", 0x0 }, |
| 1759 | { "Line", 0x2 }, |
| 1760 | { "CD", 0x4 }, |
| 1761 | { "Front Mic", 0xb }, |
| 1762 | { "Input Mix", 0xa }, |
| 1763 | }, |
| 1764 | }, |
| 1765 | { |
| 1766 | .num_items = 4, |
| 1767 | .items = { |
| 1768 | { "Mic", 0x0 }, |
| 1769 | { "Line", 0x2 }, |
| 1770 | { "CD", 0x4 }, |
| 1771 | { "Input Mix", 0xa }, |
| 1772 | }, |
| 1773 | }, |
| 1774 | { |
| 1775 | .num_items = 4, |
| 1776 | .items = { |
| 1777 | { "Mic", 0x0 }, |
| 1778 | { "Line", 0x2 }, |
| 1779 | { "CD", 0x4 }, |
| 1780 | { "Input Mix", 0xa }, |
| 1781 | }, |
| 1782 | } |
| 1783 | }; |
| 1784 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1785 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1786 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1787 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1788 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1789 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1790 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1791 | HDA_OUTPUT), |
| 1792 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1793 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1794 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1795 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1796 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1797 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1798 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1799 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1800 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1801 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1802 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1803 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1804 | { } /* end */ |
| 1805 | }; |
| 1806 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 1807 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 1808 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1809 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1810 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1811 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1812 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1813 | HDA_OUTPUT), |
| 1814 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1815 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1816 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1817 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1818 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1819 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1820 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1821 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1822 | { } /* end */ |
| 1823 | }; |
| 1824 | |
| 1825 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1826 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1827 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1828 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1829 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1830 | spec->autocfg.hp_pins[0] = 0x15; |
| 1831 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 1832 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1833 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1834 | } |
| 1835 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1836 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1837 | { |
| 1838 | struct alc_spec *spec = codec->spec; |
| 1839 | |
| 1840 | spec->autocfg.hp_pins[0] = 0x15; |
| 1841 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1842 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1843 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1844 | } |
| 1845 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1846 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1847 | { |
| 1848 | struct alc_spec *spec = codec->spec; |
| 1849 | |
| 1850 | spec->autocfg.hp_pins[0] = 0x15; |
| 1851 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1852 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1853 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1854 | } |
| 1855 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1856 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1857 | * ALC880 3-stack model |
| 1858 | * |
| 1859 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1860 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1861 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1862 | */ |
| 1863 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1864 | static hda_nid_t alc880_dac_nids[4] = { |
| 1865 | /* front, rear, clfe, rear_surr */ |
| 1866 | 0x02, 0x05, 0x04, 0x03 |
| 1867 | }; |
| 1868 | |
| 1869 | static hda_nid_t alc880_adc_nids[3] = { |
| 1870 | /* ADC0-2 */ |
| 1871 | 0x07, 0x08, 0x09, |
| 1872 | }; |
| 1873 | |
| 1874 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1875 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1876 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1877 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1878 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1879 | /* ADC1-2 */ |
| 1880 | 0x08, 0x09, |
| 1881 | }; |
| 1882 | |
| 1883 | #define ALC880_DIGOUT_NID 0x06 |
| 1884 | #define ALC880_DIGIN_NID 0x0a |
| 1885 | |
| 1886 | static struct hda_input_mux alc880_capture_source = { |
| 1887 | .num_items = 4, |
| 1888 | .items = { |
| 1889 | { "Mic", 0x0 }, |
| 1890 | { "Front Mic", 0x3 }, |
| 1891 | { "Line", 0x2 }, |
| 1892 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1893 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1894 | }; |
| 1895 | |
| 1896 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1897 | /* 2ch mode */ |
| 1898 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1899 | /* set line-in to input, mute it */ |
| 1900 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1901 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1902 | /* set mic-in to input vref 80%, mute it */ |
| 1903 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1904 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1905 | { } /* end */ |
| 1906 | }; |
| 1907 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1908 | /* 6ch mode */ |
| 1909 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1910 | /* set line-in to output, unmute it */ |
| 1911 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1912 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1913 | /* set mic-in to output, unmute it */ |
| 1914 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1915 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1916 | { } /* end */ |
| 1917 | }; |
| 1918 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1919 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1920 | { 2, alc880_threestack_ch2_init }, |
| 1921 | { 6, alc880_threestack_ch6_init }, |
| 1922 | }; |
| 1923 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1924 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1925 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1926 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1927 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1928 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1929 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1930 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1931 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1932 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1933 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1934 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1935 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1936 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1937 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1938 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1939 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1940 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1941 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1942 | { |
| 1943 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1944 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1945 | .info = alc_ch_mode_info, |
| 1946 | .get = alc_ch_mode_get, |
| 1947 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1948 | }, |
| 1949 | { } /* end */ |
| 1950 | }; |
| 1951 | |
| 1952 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1953 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1954 | struct snd_ctl_elem_info *uinfo) |
| 1955 | { |
| 1956 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1957 | struct alc_spec *spec = codec->spec; |
| 1958 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1959 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1960 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1961 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1962 | HDA_INPUT); |
| 1963 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1964 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1965 | return err; |
| 1966 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1967 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1968 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1969 | unsigned int size, unsigned int __user *tlv) |
| 1970 | { |
| 1971 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1972 | struct alc_spec *spec = codec->spec; |
| 1973 | int err; |
| 1974 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1975 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1976 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1977 | HDA_INPUT); |
| 1978 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1979 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1980 | return err; |
| 1981 | } |
| 1982 | |
| 1983 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1984 | struct snd_ctl_elem_value *ucontrol); |
| 1985 | |
| 1986 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1987 | struct snd_ctl_elem_value *ucontrol, |
| 1988 | getput_call_t func) |
| 1989 | { |
| 1990 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1991 | struct alc_spec *spec = codec->spec; |
| 1992 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1993 | int err; |
| 1994 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1995 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1996 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1997 | 3, 0, HDA_INPUT); |
| 1998 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1999 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2000 | return err; |
| 2001 | } |
| 2002 | |
| 2003 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2004 | struct snd_ctl_elem_value *ucontrol) |
| 2005 | { |
| 2006 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2007 | snd_hda_mixer_amp_volume_get); |
| 2008 | } |
| 2009 | |
| 2010 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2011 | struct snd_ctl_elem_value *ucontrol) |
| 2012 | { |
| 2013 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2014 | snd_hda_mixer_amp_volume_put); |
| 2015 | } |
| 2016 | |
| 2017 | /* capture mixer elements */ |
| 2018 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2019 | |
| 2020 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2021 | struct snd_ctl_elem_value *ucontrol) |
| 2022 | { |
| 2023 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2024 | snd_hda_mixer_amp_switch_get); |
| 2025 | } |
| 2026 | |
| 2027 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2028 | struct snd_ctl_elem_value *ucontrol) |
| 2029 | { |
| 2030 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2031 | snd_hda_mixer_amp_switch_put); |
| 2032 | } |
| 2033 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2034 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2035 | { \ |
| 2036 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2037 | .name = "Capture Switch", \ |
| 2038 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2039 | .count = num, \ |
| 2040 | .info = alc_cap_sw_info, \ |
| 2041 | .get = alc_cap_sw_get, \ |
| 2042 | .put = alc_cap_sw_put, \ |
| 2043 | }, \ |
| 2044 | { \ |
| 2045 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2046 | .name = "Capture Volume", \ |
| 2047 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2048 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2049 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2050 | .count = num, \ |
| 2051 | .info = alc_cap_vol_info, \ |
| 2052 | .get = alc_cap_vol_get, \ |
| 2053 | .put = alc_cap_vol_put, \ |
| 2054 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2055 | } |
| 2056 | |
| 2057 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2058 | { \ |
| 2059 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2060 | /* .name = "Capture Source", */ \ |
| 2061 | .name = "Input Source", \ |
| 2062 | .count = num, \ |
| 2063 | .info = alc_mux_enum_info, \ |
| 2064 | .get = alc_mux_enum_get, \ |
| 2065 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2066 | } |
| 2067 | |
| 2068 | #define DEFINE_CAPMIX(num) \ |
| 2069 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2070 | _DEFINE_CAPMIX(num), \ |
| 2071 | _DEFINE_CAPSRC(num), \ |
| 2072 | { } /* end */ \ |
| 2073 | } |
| 2074 | |
| 2075 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2076 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2077 | _DEFINE_CAPMIX(num), \ |
| 2078 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2079 | } |
| 2080 | |
| 2081 | /* up to three ADCs */ |
| 2082 | DEFINE_CAPMIX(1); |
| 2083 | DEFINE_CAPMIX(2); |
| 2084 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2085 | DEFINE_CAPMIX_NOSRC(1); |
| 2086 | DEFINE_CAPMIX_NOSRC(2); |
| 2087 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2088 | |
| 2089 | /* |
| 2090 | * ALC880 5-stack model |
| 2091 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2092 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2093 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2094 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2095 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2096 | */ |
| 2097 | |
| 2098 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2099 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2100 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2101 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2102 | { } /* end */ |
| 2103 | }; |
| 2104 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2105 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2106 | /* 6ch mode */ |
| 2107 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2108 | /* set line-in to input, mute it */ |
| 2109 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2110 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2111 | { } /* end */ |
| 2112 | }; |
| 2113 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2114 | /* 8ch mode */ |
| 2115 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2116 | /* set line-in to output, unmute it */ |
| 2117 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2118 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2119 | { } /* end */ |
| 2120 | }; |
| 2121 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2122 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2123 | { 6, alc880_fivestack_ch6_init }, |
| 2124 | { 8, alc880_fivestack_ch8_init }, |
| 2125 | }; |
| 2126 | |
| 2127 | |
| 2128 | /* |
| 2129 | * ALC880 6-stack model |
| 2130 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2131 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2132 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2133 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2134 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2135 | */ |
| 2136 | |
| 2137 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2138 | /* front, rear, clfe, rear_surr */ |
| 2139 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2140 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2141 | |
| 2142 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2143 | .num_items = 4, |
| 2144 | .items = { |
| 2145 | { "Mic", 0x0 }, |
| 2146 | { "Front Mic", 0x1 }, |
| 2147 | { "Line", 0x2 }, |
| 2148 | { "CD", 0x4 }, |
| 2149 | }, |
| 2150 | }; |
| 2151 | |
| 2152 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2153 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2154 | { 8, NULL }, |
| 2155 | }; |
| 2156 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2157 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2158 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2159 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2160 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2161 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2162 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2163 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2164 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2165 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2166 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2167 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2168 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2169 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2170 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2171 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2172 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2173 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2174 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2175 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2176 | { |
| 2177 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2178 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2179 | .info = alc_ch_mode_info, |
| 2180 | .get = alc_ch_mode_get, |
| 2181 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2182 | }, |
| 2183 | { } /* end */ |
| 2184 | }; |
| 2185 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2186 | |
| 2187 | /* |
| 2188 | * ALC880 W810 model |
| 2189 | * |
| 2190 | * W810 has rear IO for: |
| 2191 | * Front (DAC 02) |
| 2192 | * Surround (DAC 03) |
| 2193 | * Center/LFE (DAC 04) |
| 2194 | * Digital out (06) |
| 2195 | * |
| 2196 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2197 | * 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] | 2198 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2199 | * There is a variable resistor to control the speaker or headphone |
| 2200 | * volume. This is a hardware-only device without a software API. |
| 2201 | * |
| 2202 | * Plugging headphones in will disable the internal speakers. This is |
| 2203 | * implemented in hardware, not via the driver using jack sense. In |
| 2204 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2205 | * disable both the speakers and headphones. |
| 2206 | * |
| 2207 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2208 | * These may not do anything useful with this driver yet, because I |
| 2209 | * haven't setup any initialization verbs for these yet... |
| 2210 | */ |
| 2211 | |
| 2212 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2213 | /* front, rear/surround, clfe */ |
| 2214 | 0x02, 0x03, 0x04 |
| 2215 | }; |
| 2216 | |
| 2217 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2218 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2219 | { 6, NULL } |
| 2220 | }; |
| 2221 | |
| 2222 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2223 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2224 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2225 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2226 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2227 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2228 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2229 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2230 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2231 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2232 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2233 | { } /* end */ |
| 2234 | }; |
| 2235 | |
| 2236 | |
| 2237 | /* |
| 2238 | * Z710V model |
| 2239 | * |
| 2240 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2241 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2242 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2243 | */ |
| 2244 | |
| 2245 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2246 | 0x02 |
| 2247 | }; |
| 2248 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2249 | |
| 2250 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2251 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2252 | { 2, NULL } |
| 2253 | }; |
| 2254 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2255 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2256 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2257 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2258 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2259 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2260 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2261 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2262 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2263 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2264 | { } /* end */ |
| 2265 | }; |
| 2266 | |
| 2267 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2268 | /* |
| 2269 | * ALC880 F1734 model |
| 2270 | * |
| 2271 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2272 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2273 | */ |
| 2274 | |
| 2275 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2276 | 0x03 |
| 2277 | }; |
| 2278 | #define ALC880_F1734_HP_DAC 0x02 |
| 2279 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2280 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2281 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2282 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2283 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2284 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2285 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2286 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2287 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2288 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2289 | { } /* end */ |
| 2290 | }; |
| 2291 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2292 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2293 | .num_items = 2, |
| 2294 | .items = { |
| 2295 | { "Mic", 0x1 }, |
| 2296 | { "CD", 0x4 }, |
| 2297 | }, |
| 2298 | }; |
| 2299 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2300 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2301 | /* |
| 2302 | * ALC880 ASUS model |
| 2303 | * |
| 2304 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2305 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2306 | * Mic = 0x18, Line = 0x1a |
| 2307 | */ |
| 2308 | |
| 2309 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2310 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2311 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2312 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2313 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2314 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2315 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2316 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2317 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2318 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2319 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2320 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2321 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2322 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2323 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2324 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2325 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2326 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2327 | { |
| 2328 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2329 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2330 | .info = alc_ch_mode_info, |
| 2331 | .get = alc_ch_mode_get, |
| 2332 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2333 | }, |
| 2334 | { } /* end */ |
| 2335 | }; |
| 2336 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2337 | /* |
| 2338 | * ALC880 ASUS W1V model |
| 2339 | * |
| 2340 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2341 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2342 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2343 | */ |
| 2344 | |
| 2345 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2346 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2347 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2348 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2349 | { } /* end */ |
| 2350 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2351 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2352 | /* TCL S700 */ |
| 2353 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2354 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2355 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2356 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2357 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2358 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2359 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2360 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2361 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2362 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2363 | { } /* end */ |
| 2364 | }; |
| 2365 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2366 | /* Uniwill */ |
| 2367 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2368 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2369 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2370 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2371 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2372 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2373 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2374 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2375 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2376 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2377 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2378 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2379 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2380 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2381 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2382 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2383 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2384 | { |
| 2385 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2386 | .name = "Channel Mode", |
| 2387 | .info = alc_ch_mode_info, |
| 2388 | .get = alc_ch_mode_get, |
| 2389 | .put = alc_ch_mode_put, |
| 2390 | }, |
| 2391 | { } /* end */ |
| 2392 | }; |
| 2393 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2394 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2395 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2396 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2397 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2398 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2399 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2400 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2401 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2402 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2403 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2404 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2405 | { } /* end */ |
| 2406 | }; |
| 2407 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2408 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2409 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2410 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2411 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2412 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2413 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2414 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2415 | { } /* end */ |
| 2416 | }; |
| 2417 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2418 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2419 | * virtual master controls |
| 2420 | */ |
| 2421 | |
| 2422 | /* |
| 2423 | * slave controls for virtual master |
| 2424 | */ |
| 2425 | static const char *alc_slave_vols[] = { |
| 2426 | "Front Playback Volume", |
| 2427 | "Surround Playback Volume", |
| 2428 | "Center Playback Volume", |
| 2429 | "LFE Playback Volume", |
| 2430 | "Side Playback Volume", |
| 2431 | "Headphone Playback Volume", |
| 2432 | "Speaker Playback Volume", |
| 2433 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2434 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2435 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2436 | NULL, |
| 2437 | }; |
| 2438 | |
| 2439 | static const char *alc_slave_sws[] = { |
| 2440 | "Front Playback Switch", |
| 2441 | "Surround Playback Switch", |
| 2442 | "Center Playback Switch", |
| 2443 | "LFE Playback Switch", |
| 2444 | "Side Playback Switch", |
| 2445 | "Headphone Playback Switch", |
| 2446 | "Speaker Playback Switch", |
| 2447 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2448 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2449 | "Line-Out Playback Switch", |
| 2450 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2451 | NULL, |
| 2452 | }; |
| 2453 | |
| 2454 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2455 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2456 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2457 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2458 | #define NID_MAPPING (-1) |
| 2459 | |
| 2460 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2461 | #define SUBDEV_HP_ (1 << 6) |
| 2462 | #define SUBDEV_LINE_ (2 << 6) |
| 2463 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2464 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2465 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2466 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2467 | static void alc_free_kctls(struct hda_codec *codec); |
| 2468 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2469 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2470 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2471 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2472 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2473 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2474 | { } /* end */ |
| 2475 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2476 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2477 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2478 | static int alc_build_controls(struct hda_codec *codec) |
| 2479 | { |
| 2480 | struct alc_spec *spec = codec->spec; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2481 | struct snd_kcontrol *kctl; |
| 2482 | struct snd_kcontrol_new *knew; |
| 2483 | int i, j, err; |
| 2484 | unsigned int u; |
| 2485 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2486 | |
| 2487 | for (i = 0; i < spec->num_mixers; i++) { |
| 2488 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2489 | if (err < 0) |
| 2490 | return err; |
| 2491 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2492 | if (spec->cap_mixer) { |
| 2493 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2494 | if (err < 0) |
| 2495 | return err; |
| 2496 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2497 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2498 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2499 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2500 | if (err < 0) |
| 2501 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2502 | if (!spec->no_analog) { |
| 2503 | err = snd_hda_create_spdif_share_sw(codec, |
| 2504 | &spec->multiout); |
| 2505 | if (err < 0) |
| 2506 | return err; |
| 2507 | spec->multiout.share_spdif = 1; |
| 2508 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2509 | } |
| 2510 | if (spec->dig_in_nid) { |
| 2511 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2512 | if (err < 0) |
| 2513 | return err; |
| 2514 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2515 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2516 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2517 | /* create beep controls if needed */ |
| 2518 | if (spec->beep_amp) { |
| 2519 | struct snd_kcontrol_new *knew; |
| 2520 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2521 | struct snd_kcontrol *kctl; |
| 2522 | kctl = snd_ctl_new1(knew, codec); |
| 2523 | if (!kctl) |
| 2524 | return -ENOMEM; |
| 2525 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2526 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2527 | if (err < 0) |
| 2528 | return err; |
| 2529 | } |
| 2530 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2531 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2532 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2533 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2534 | if (!spec->no_analog && |
| 2535 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2536 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2537 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2538 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2539 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2540 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2541 | if (err < 0) |
| 2542 | return err; |
| 2543 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2544 | if (!spec->no_analog && |
| 2545 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2546 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2547 | NULL, alc_slave_sws); |
| 2548 | if (err < 0) |
| 2549 | return err; |
| 2550 | } |
| 2551 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2552 | /* assign Capture Source enums to NID */ |
| 2553 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 2554 | if (!kctl) |
| 2555 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 2556 | for (i = 0; kctl && i < kctl->count; i++) { |
Takashi Iwai | d1409ae | 2009-12-17 15:01:31 +0100 | [diff] [blame] | 2557 | hda_nid_t *nids = spec->capsrc_nids; |
| 2558 | if (!nids) |
| 2559 | nids = spec->adc_nids; |
Takashi Iwai | 21949f0 | 2009-12-23 08:31:59 +0100 | [diff] [blame] | 2560 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2561 | if (err < 0) |
| 2562 | return err; |
| 2563 | } |
| 2564 | if (spec->cap_mixer) { |
| 2565 | const char *kname = kctl ? kctl->id.name : NULL; |
| 2566 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 2567 | if (kname && strcmp(knew->name, kname) == 0) |
| 2568 | continue; |
| 2569 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2570 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2571 | err = snd_hda_add_nid(codec, kctl, i, |
| 2572 | spec->adc_nids[i]); |
| 2573 | if (err < 0) |
| 2574 | return err; |
| 2575 | } |
| 2576 | } |
| 2577 | } |
| 2578 | |
| 2579 | /* other nid->control mapping */ |
| 2580 | for (i = 0; i < spec->num_mixers; i++) { |
| 2581 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 2582 | if (knew->iface != NID_MAPPING) |
| 2583 | continue; |
| 2584 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2585 | if (kctl == NULL) |
| 2586 | continue; |
| 2587 | u = knew->subdevice; |
| 2588 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2589 | nid = u & 0x3f; |
| 2590 | if (nid == 0) |
| 2591 | continue; |
| 2592 | switch (u & 0xc0) { |
| 2593 | case SUBDEV_SPEAKER_: |
| 2594 | nid = spec->autocfg.speaker_pins[nid]; |
| 2595 | break; |
| 2596 | case SUBDEV_LINE_: |
| 2597 | nid = spec->autocfg.line_out_pins[nid]; |
| 2598 | break; |
| 2599 | case SUBDEV_HP_: |
| 2600 | nid = spec->autocfg.hp_pins[nid]; |
| 2601 | break; |
| 2602 | default: |
| 2603 | continue; |
| 2604 | } |
| 2605 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2606 | if (err < 0) |
| 2607 | return err; |
| 2608 | } |
| 2609 | u = knew->private_value; |
| 2610 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2611 | nid = u & 0xff; |
| 2612 | if (nid == 0) |
| 2613 | continue; |
| 2614 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2615 | if (err < 0) |
| 2616 | return err; |
| 2617 | } |
| 2618 | } |
| 2619 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 2620 | |
| 2621 | alc_free_kctls(codec); /* no longer needed */ |
| 2622 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2623 | return 0; |
| 2624 | } |
| 2625 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2626 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2627 | /* |
| 2628 | * initialize the codec volumes, etc |
| 2629 | */ |
| 2630 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2631 | /* |
| 2632 | * generic initialization of ADC, input mixers and output mixers |
| 2633 | */ |
| 2634 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2635 | /* |
| 2636 | * Unmute ADC0-2 and set the default input to mic-in |
| 2637 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2638 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2639 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2640 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2641 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2642 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2643 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2644 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2645 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2646 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2647 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2648 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2649 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2650 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2651 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2652 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2653 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2654 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2655 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2656 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2657 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2658 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2659 | /* |
| 2660 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2661 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2662 | /* set vol=0 to output mixers */ |
| 2663 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2664 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2665 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2666 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2667 | /* set up input amps for analog loopback */ |
| 2668 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2669 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2670 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2671 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2672 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2673 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2674 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2675 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2676 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2677 | |
| 2678 | { } |
| 2679 | }; |
| 2680 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2681 | /* |
| 2682 | * 3-stack pin configuration: |
| 2683 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2684 | */ |
| 2685 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2686 | /* |
| 2687 | * preset connection lists of input pins |
| 2688 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2689 | */ |
| 2690 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2691 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2692 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2693 | |
| 2694 | /* |
| 2695 | * Set pin mode and muting |
| 2696 | */ |
| 2697 | /* set front pin widgets 0x14 for output */ |
| 2698 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2699 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2700 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2701 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2702 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2703 | /* Mic2 (as headphone out) for HP output */ |
| 2704 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2705 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2706 | /* Line In pin widget for input */ |
| 2707 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2708 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2709 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2710 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2711 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2712 | /* CD pin widget for input */ |
| 2713 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2714 | |
| 2715 | { } |
| 2716 | }; |
| 2717 | |
| 2718 | /* |
| 2719 | * 5-stack pin configuration: |
| 2720 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2721 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2722 | */ |
| 2723 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2724 | /* |
| 2725 | * preset connection lists of input pins |
| 2726 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2727 | */ |
| 2728 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2729 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2730 | |
| 2731 | /* |
| 2732 | * Set pin mode and muting |
| 2733 | */ |
| 2734 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2735 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2736 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2737 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2738 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2739 | /* unmute pins for output (no gain on this amp) */ |
| 2740 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2741 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2742 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2743 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2744 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2745 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2746 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2747 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2748 | /* Mic2 (as headphone out) for HP output */ |
| 2749 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2750 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2751 | /* Line In pin widget for input */ |
| 2752 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2753 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2754 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2755 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2756 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2757 | /* CD pin widget for input */ |
| 2758 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2759 | |
| 2760 | { } |
| 2761 | }; |
| 2762 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2763 | /* |
| 2764 | * W810 pin configuration: |
| 2765 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2766 | */ |
| 2767 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2768 | /* hphone/speaker input selector: front DAC */ |
| 2769 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2770 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2771 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2772 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2773 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2774 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2775 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2776 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2777 | |
| 2778 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2779 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2780 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2781 | { } |
| 2782 | }; |
| 2783 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2784 | /* |
| 2785 | * Z71V pin configuration: |
| 2786 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2787 | */ |
| 2788 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2789 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2790 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2791 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2792 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2793 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2794 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2795 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2796 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2797 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2798 | |
| 2799 | { } |
| 2800 | }; |
| 2801 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2802 | /* |
| 2803 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2804 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2805 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2806 | */ |
| 2807 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2808 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2809 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2810 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2811 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2812 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2813 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2814 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2815 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2816 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2817 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2818 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2819 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2820 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2821 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2822 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2823 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2824 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2825 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2826 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2827 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2828 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2829 | { } |
| 2830 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2831 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2832 | /* |
| 2833 | * Uniwill pin configuration: |
| 2834 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2835 | * line = 0x1a |
| 2836 | */ |
| 2837 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2838 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2839 | |
| 2840 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2841 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2842 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2843 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2844 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2845 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2846 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2847 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2848 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2849 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2850 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2851 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2852 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2853 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2854 | |
| 2855 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2856 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2857 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2858 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2859 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2860 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2861 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2862 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2863 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2864 | |
| 2865 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2866 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2867 | |
| 2868 | { } |
| 2869 | }; |
| 2870 | |
| 2871 | /* |
| 2872 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2873 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2874 | */ |
| 2875 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2876 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2877 | |
| 2878 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2879 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2880 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2881 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2882 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2883 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2884 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2885 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2886 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2887 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2888 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2889 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2890 | |
| 2891 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2892 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2893 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2894 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2895 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2896 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2897 | |
| 2898 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2899 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2900 | |
| 2901 | { } |
| 2902 | }; |
| 2903 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2904 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2905 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2906 | { } |
| 2907 | }; |
| 2908 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2909 | /* auto-toggle front mic */ |
| 2910 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2911 | { |
| 2912 | unsigned int present; |
| 2913 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2914 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 2915 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2916 | bits = present ? HDA_AMP_MUTE : 0; |
| 2917 | 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] | 2918 | } |
| 2919 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2920 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2921 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2922 | struct alc_spec *spec = codec->spec; |
| 2923 | |
| 2924 | spec->autocfg.hp_pins[0] = 0x14; |
| 2925 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2926 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2927 | } |
| 2928 | |
| 2929 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 2930 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2931 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2932 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2933 | } |
| 2934 | |
| 2935 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2936 | unsigned int res) |
| 2937 | { |
| 2938 | /* Looks like the unsol event is incompatible with the standard |
| 2939 | * definition. 4bit tag is placed at 28 bit! |
| 2940 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2941 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2942 | case ALC880_MIC_EVENT: |
| 2943 | alc880_uniwill_mic_automute(codec); |
| 2944 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2945 | default: |
| 2946 | alc_automute_amp_unsol_event(codec, res); |
| 2947 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2948 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2949 | } |
| 2950 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2951 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2952 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2953 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2954 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2955 | spec->autocfg.hp_pins[0] = 0x14; |
| 2956 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2957 | } |
| 2958 | |
| 2959 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2960 | { |
| 2961 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2962 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2963 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2964 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2965 | present &= HDA_AMP_VOLMASK; |
| 2966 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2967 | HDA_AMP_VOLMASK, present); |
| 2968 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2969 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2970 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2971 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2972 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2973 | unsigned int res) |
| 2974 | { |
| 2975 | /* Looks like the unsol event is incompatible with the standard |
| 2976 | * definition. 4bit tag is placed at 28 bit! |
| 2977 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2978 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2979 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2980 | else |
| 2981 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2982 | } |
| 2983 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2984 | /* |
| 2985 | * F1734 pin configuration: |
| 2986 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2987 | */ |
| 2988 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2989 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2990 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2991 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2992 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2993 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2994 | |
| 2995 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2996 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2997 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2998 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2999 | |
| 3000 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3001 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3002 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3003 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3004 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3005 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3006 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3007 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3008 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3009 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3010 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3011 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3012 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3013 | { } |
| 3014 | }; |
| 3015 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3016 | /* |
| 3017 | * ASUS pin configuration: |
| 3018 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3019 | */ |
| 3020 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3021 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3022 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3023 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3024 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3025 | |
| 3026 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3027 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3028 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3029 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3030 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3031 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3032 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3033 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3034 | |
| 3035 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3036 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3037 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3038 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3039 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3040 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3041 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3042 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3043 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3044 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3045 | { } |
| 3046 | }; |
| 3047 | |
| 3048 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3049 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3050 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3051 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3052 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3053 | /* Clevo m520g init */ |
| 3054 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3055 | /* headphone output */ |
| 3056 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3057 | /* line-out */ |
| 3058 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3059 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3060 | /* Line-in */ |
| 3061 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3062 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3063 | /* CD */ |
| 3064 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3065 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3066 | /* Mic1 (rear panel) */ |
| 3067 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3068 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3069 | /* Mic2 (front panel) */ |
| 3070 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3071 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3072 | /* headphone */ |
| 3073 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3074 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3075 | /* change to EAPD mode */ |
| 3076 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3077 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3078 | |
| 3079 | { } |
| 3080 | }; |
| 3081 | |
| 3082 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3083 | /* change to EAPD mode */ |
| 3084 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3085 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3086 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3087 | /* Headphone output */ |
| 3088 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3089 | /* Front output*/ |
| 3090 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3091 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3092 | |
| 3093 | /* Line In pin widget for input */ |
| 3094 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3095 | /* CD pin widget for input */ |
| 3096 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3097 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3098 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3099 | |
| 3100 | /* change to EAPD mode */ |
| 3101 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3102 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3103 | |
| 3104 | { } |
| 3105 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3106 | |
| 3107 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3108 | * LG m1 express dual |
| 3109 | * |
| 3110 | * Pin assignment: |
| 3111 | * Rear Line-In/Out (blue): 0x14 |
| 3112 | * Build-in Mic-In: 0x15 |
| 3113 | * Speaker-out: 0x17 |
| 3114 | * HP-Out (green): 0x1b |
| 3115 | * Mic-In/Out (red): 0x19 |
| 3116 | * SPDIF-Out: 0x1e |
| 3117 | */ |
| 3118 | |
| 3119 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3120 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3121 | 0x05, 0x02, 0x03 |
| 3122 | }; |
| 3123 | |
| 3124 | /* seems analog CD is not working */ |
| 3125 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3126 | .num_items = 3, |
| 3127 | .items = { |
| 3128 | { "Mic", 0x1 }, |
| 3129 | { "Line", 0x5 }, |
| 3130 | { "Internal Mic", 0x6 }, |
| 3131 | }, |
| 3132 | }; |
| 3133 | |
| 3134 | /* 2,4,6 channel modes */ |
| 3135 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3136 | /* set line-in and mic-in to input */ |
| 3137 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3138 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3139 | { } |
| 3140 | }; |
| 3141 | |
| 3142 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3143 | /* set line-in to out and mic-in to input */ |
| 3144 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3145 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3146 | { } |
| 3147 | }; |
| 3148 | |
| 3149 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3150 | /* set line-in and mic-in to output */ |
| 3151 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3152 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3153 | { } |
| 3154 | }; |
| 3155 | |
| 3156 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3157 | { 2, alc880_lg_ch2_init }, |
| 3158 | { 4, alc880_lg_ch4_init }, |
| 3159 | { 6, alc880_lg_ch6_init }, |
| 3160 | }; |
| 3161 | |
| 3162 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3163 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3164 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3165 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3166 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3167 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3168 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3169 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3170 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3171 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3172 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3173 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3174 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3175 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3176 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3177 | { |
| 3178 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3179 | .name = "Channel Mode", |
| 3180 | .info = alc_ch_mode_info, |
| 3181 | .get = alc_ch_mode_get, |
| 3182 | .put = alc_ch_mode_put, |
| 3183 | }, |
| 3184 | { } /* end */ |
| 3185 | }; |
| 3186 | |
| 3187 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3188 | /* set capture source to mic-in */ |
| 3189 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3190 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3191 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3192 | /* mute all amp mixer inputs */ |
| 3193 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3194 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3195 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3196 | /* line-in to input */ |
| 3197 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3198 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3199 | /* built-in mic */ |
| 3200 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3201 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3202 | /* speaker-out */ |
| 3203 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3204 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3205 | /* mic-in to input */ |
| 3206 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3207 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3208 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3209 | /* HP-out */ |
| 3210 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3211 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3212 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3213 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3214 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3215 | { } |
| 3216 | }; |
| 3217 | |
| 3218 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3219 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3220 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3221 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3222 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3223 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3224 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3225 | } |
| 3226 | |
| 3227 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3228 | * LG LW20 |
| 3229 | * |
| 3230 | * Pin assignment: |
| 3231 | * Speaker-out: 0x14 |
| 3232 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3233 | * Built-in Mic-In: 0x19 |
| 3234 | * Line-In: 0x1b |
| 3235 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3236 | * SPDIF-Out: 0x1e |
| 3237 | */ |
| 3238 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3239 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3240 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3241 | .items = { |
| 3242 | { "Mic", 0x0 }, |
| 3243 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3244 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3245 | }, |
| 3246 | }; |
| 3247 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3248 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3249 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3250 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3251 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3252 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3253 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3254 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3255 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3256 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3257 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3258 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3259 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3260 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3261 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3262 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3263 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3264 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3265 | { |
| 3266 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3267 | .name = "Channel Mode", |
| 3268 | .info = alc_ch_mode_info, |
| 3269 | .get = alc_ch_mode_get, |
| 3270 | .put = alc_ch_mode_put, |
| 3271 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3272 | { } /* end */ |
| 3273 | }; |
| 3274 | |
| 3275 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3276 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3277 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3278 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3279 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3280 | /* set capture source to mic-in */ |
| 3281 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3282 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3283 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3284 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3285 | /* speaker-out */ |
| 3286 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3287 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3288 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3289 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3290 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3291 | /* mic-in to input */ |
| 3292 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3293 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3294 | /* built-in mic */ |
| 3295 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3296 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3297 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3298 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3299 | { } |
| 3300 | }; |
| 3301 | |
| 3302 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3303 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3304 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3305 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3306 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3307 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3308 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3309 | } |
| 3310 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3311 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3312 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3313 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3314 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3315 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3316 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3317 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3318 | { } /* end */ |
| 3319 | }; |
| 3320 | |
| 3321 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3322 | .num_items = 2, |
| 3323 | .items = { |
| 3324 | { "Mic", 0x0 }, |
| 3325 | { "Internal Mic", 0x1 }, |
| 3326 | }, |
| 3327 | }; |
| 3328 | |
| 3329 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3330 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3331 | |
| 3332 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3333 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3334 | |
| 3335 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3336 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3337 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3338 | /* Mic2 (as headphone out) for HP output */ |
| 3339 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3340 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3341 | /* Internal Speaker */ |
| 3342 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3343 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3344 | |
| 3345 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3346 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3347 | |
| 3348 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3349 | { } |
| 3350 | }; |
| 3351 | |
| 3352 | /* toggle speaker-output according to the hp-jack state */ |
| 3353 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3354 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3355 | struct alc_spec *spec = codec->spec; |
| 3356 | alc_automute_amp(codec); |
| 3357 | /* toggle EAPD */ |
| 3358 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3359 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3360 | else |
| 3361 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3362 | } |
| 3363 | |
| 3364 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3365 | unsigned int res) |
| 3366 | { |
| 3367 | /* Looks like the unsol event is incompatible with the standard |
| 3368 | * definition. 4bit tag is placed at 28 bit! |
| 3369 | */ |
| 3370 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3371 | alc880_medion_rim_automute(codec); |
| 3372 | } |
| 3373 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3374 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3375 | { |
| 3376 | struct alc_spec *spec = codec->spec; |
| 3377 | |
| 3378 | spec->autocfg.hp_pins[0] = 0x14; |
| 3379 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3380 | } |
| 3381 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3382 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3383 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3384 | { 0x0b, HDA_INPUT, 0 }, |
| 3385 | { 0x0b, HDA_INPUT, 1 }, |
| 3386 | { 0x0b, HDA_INPUT, 2 }, |
| 3387 | { 0x0b, HDA_INPUT, 3 }, |
| 3388 | { 0x0b, HDA_INPUT, 4 }, |
| 3389 | { } /* end */ |
| 3390 | }; |
| 3391 | |
| 3392 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3393 | { 0x0b, HDA_INPUT, 1 }, |
| 3394 | { 0x0b, HDA_INPUT, 6 }, |
| 3395 | { 0x0b, HDA_INPUT, 7 }, |
| 3396 | { } /* end */ |
| 3397 | }; |
| 3398 | #endif |
| 3399 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3400 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3401 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3402 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3403 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3404 | static int alc_init(struct hda_codec *codec) |
| 3405 | { |
| 3406 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3407 | unsigned int i; |
| 3408 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3409 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3410 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3411 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3412 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3413 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3414 | |
| 3415 | if (spec->init_hook) |
| 3416 | spec->init_hook(codec); |
| 3417 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3418 | return 0; |
| 3419 | } |
| 3420 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3421 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3422 | { |
| 3423 | struct alc_spec *spec = codec->spec; |
| 3424 | |
| 3425 | if (spec->unsol_event) |
| 3426 | spec->unsol_event(codec, res); |
| 3427 | } |
| 3428 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3429 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3430 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3431 | { |
| 3432 | struct alc_spec *spec = codec->spec; |
| 3433 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3434 | } |
| 3435 | #endif |
| 3436 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3437 | /* |
| 3438 | * Analog playback callbacks |
| 3439 | */ |
| 3440 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3441 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3442 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3443 | { |
| 3444 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3445 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3446 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3447 | } |
| 3448 | |
| 3449 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3450 | struct hda_codec *codec, |
| 3451 | unsigned int stream_tag, |
| 3452 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3453 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3454 | { |
| 3455 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3456 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3457 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3458 | } |
| 3459 | |
| 3460 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3461 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3462 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3463 | { |
| 3464 | struct alc_spec *spec = codec->spec; |
| 3465 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3466 | } |
| 3467 | |
| 3468 | /* |
| 3469 | * Digital out |
| 3470 | */ |
| 3471 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3472 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3473 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3474 | { |
| 3475 | struct alc_spec *spec = codec->spec; |
| 3476 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3477 | } |
| 3478 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3479 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3480 | struct hda_codec *codec, |
| 3481 | unsigned int stream_tag, |
| 3482 | unsigned int format, |
| 3483 | struct snd_pcm_substream *substream) |
| 3484 | { |
| 3485 | struct alc_spec *spec = codec->spec; |
| 3486 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3487 | stream_tag, format, substream); |
| 3488 | } |
| 3489 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3490 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3491 | struct hda_codec *codec, |
| 3492 | struct snd_pcm_substream *substream) |
| 3493 | { |
| 3494 | struct alc_spec *spec = codec->spec; |
| 3495 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3496 | } |
| 3497 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3498 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3499 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3500 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3501 | { |
| 3502 | struct alc_spec *spec = codec->spec; |
| 3503 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3504 | } |
| 3505 | |
| 3506 | /* |
| 3507 | * Analog capture |
| 3508 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3509 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3510 | struct hda_codec *codec, |
| 3511 | unsigned int stream_tag, |
| 3512 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3513 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3514 | { |
| 3515 | struct alc_spec *spec = codec->spec; |
| 3516 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3517 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3518 | stream_tag, 0, format); |
| 3519 | return 0; |
| 3520 | } |
| 3521 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3522 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3523 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3524 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3525 | { |
| 3526 | struct alc_spec *spec = codec->spec; |
| 3527 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3528 | snd_hda_codec_cleanup_stream(codec, |
| 3529 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3530 | return 0; |
| 3531 | } |
| 3532 | |
| 3533 | |
| 3534 | /* |
| 3535 | */ |
| 3536 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3537 | .substreams = 1, |
| 3538 | .channels_min = 2, |
| 3539 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3540 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3541 | .ops = { |
| 3542 | .open = alc880_playback_pcm_open, |
| 3543 | .prepare = alc880_playback_pcm_prepare, |
| 3544 | .cleanup = alc880_playback_pcm_cleanup |
| 3545 | }, |
| 3546 | }; |
| 3547 | |
| 3548 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3549 | .substreams = 1, |
| 3550 | .channels_min = 2, |
| 3551 | .channels_max = 2, |
| 3552 | /* NID is set in alc_build_pcms */ |
| 3553 | }; |
| 3554 | |
| 3555 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3556 | .substreams = 1, |
| 3557 | .channels_min = 2, |
| 3558 | .channels_max = 2, |
| 3559 | /* NID is set in alc_build_pcms */ |
| 3560 | }; |
| 3561 | |
| 3562 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3563 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3564 | .channels_min = 2, |
| 3565 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3566 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3567 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3568 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3569 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3570 | }, |
| 3571 | }; |
| 3572 | |
| 3573 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3574 | .substreams = 1, |
| 3575 | .channels_min = 2, |
| 3576 | .channels_max = 2, |
| 3577 | /* NID is set in alc_build_pcms */ |
| 3578 | .ops = { |
| 3579 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3580 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3581 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3582 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3583 | }, |
| 3584 | }; |
| 3585 | |
| 3586 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3587 | .substreams = 1, |
| 3588 | .channels_min = 2, |
| 3589 | .channels_max = 2, |
| 3590 | /* NID is set in alc_build_pcms */ |
| 3591 | }; |
| 3592 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3593 | /* 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] | 3594 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3595 | .substreams = 0, |
| 3596 | .channels_min = 0, |
| 3597 | .channels_max = 0, |
| 3598 | }; |
| 3599 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3600 | static int alc_build_pcms(struct hda_codec *codec) |
| 3601 | { |
| 3602 | struct alc_spec *spec = codec->spec; |
| 3603 | struct hda_pcm *info = spec->pcm_rec; |
| 3604 | int i; |
| 3605 | |
| 3606 | codec->num_pcms = 1; |
| 3607 | codec->pcm_info = info; |
| 3608 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3609 | if (spec->no_analog) |
| 3610 | goto skip_analog; |
| 3611 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3612 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3613 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3614 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 3615 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3616 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3617 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3618 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3619 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3620 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3621 | } |
| 3622 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3623 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3624 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3625 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3626 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3627 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3628 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3629 | if (spec->channel_mode) { |
| 3630 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3631 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3632 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3633 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3634 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3635 | } |
| 3636 | } |
| 3637 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3638 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3639 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3640 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3641 | snprintf(spec->stream_name_digital, |
| 3642 | sizeof(spec->stream_name_digital), |
| 3643 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3644 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3645 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3646 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3647 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3648 | if (spec->dig_out_type) |
| 3649 | info->pcm_type = spec->dig_out_type; |
| 3650 | else |
| 3651 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3652 | if (spec->multiout.dig_out_nid && |
| 3653 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3654 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3655 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3656 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3657 | if (spec->dig_in_nid && |
| 3658 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3659 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3660 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3661 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3662 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3663 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3664 | } |
| 3665 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3666 | if (spec->no_analog) |
| 3667 | return 0; |
| 3668 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3669 | /* If the use of more than one ADC is requested for the current |
| 3670 | * model, configure a second analog capture-only PCM. |
| 3671 | */ |
| 3672 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3673 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3674 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3675 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3676 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3677 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3678 | if (spec->alt_dac_nid) { |
| 3679 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3680 | *spec->stream_analog_alt_playback; |
| 3681 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3682 | spec->alt_dac_nid; |
| 3683 | } else { |
| 3684 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3685 | alc_pcm_null_stream; |
| 3686 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3687 | } |
| 3688 | if (spec->num_adc_nids > 1) { |
| 3689 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3690 | *spec->stream_analog_alt_capture; |
| 3691 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3692 | spec->adc_nids[1]; |
| 3693 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3694 | spec->num_adc_nids - 1; |
| 3695 | } else { |
| 3696 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3697 | alc_pcm_null_stream; |
| 3698 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3699 | } |
| 3700 | } |
| 3701 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3702 | return 0; |
| 3703 | } |
| 3704 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3705 | static inline void alc_shutup(struct hda_codec *codec) |
| 3706 | { |
| 3707 | snd_hda_shutup_pins(codec); |
| 3708 | } |
| 3709 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3710 | static void alc_free_kctls(struct hda_codec *codec) |
| 3711 | { |
| 3712 | struct alc_spec *spec = codec->spec; |
| 3713 | |
| 3714 | if (spec->kctls.list) { |
| 3715 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3716 | int i; |
| 3717 | for (i = 0; i < spec->kctls.used; i++) |
| 3718 | kfree(kctl[i].name); |
| 3719 | } |
| 3720 | snd_array_free(&spec->kctls); |
| 3721 | } |
| 3722 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3723 | static void alc_free(struct hda_codec *codec) |
| 3724 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3725 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3726 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3727 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3728 | return; |
| 3729 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3730 | alc_shutup(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3731 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3732 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3733 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3734 | } |
| 3735 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3736 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3737 | static void alc_power_eapd(struct hda_codec *codec) |
| 3738 | { |
| 3739 | /* We currently only handle front, HP */ |
| 3740 | switch (codec->vendor_id) { |
| 3741 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3742 | set_eapd(codec, 0x0f, 0); |
| 3743 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3744 | break; |
| 3745 | case 0x10ec0262: |
| 3746 | case 0x10ec0267: |
| 3747 | case 0x10ec0268: |
| 3748 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3749 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3750 | case 0x10ec0272: |
| 3751 | case 0x10ec0660: |
| 3752 | case 0x10ec0662: |
| 3753 | case 0x10ec0663: |
| 3754 | case 0x10ec0862: |
| 3755 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3756 | set_eapd(codec, 0x14, 0); |
| 3757 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3758 | break; |
| 3759 | } |
| 3760 | } |
| 3761 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3762 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 3763 | { |
| 3764 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3765 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3766 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3767 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3768 | return 0; |
| 3769 | } |
| 3770 | #endif |
| 3771 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3772 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3773 | static int alc_resume(struct hda_codec *codec) |
| 3774 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3775 | codec->patch_ops.init(codec); |
| 3776 | snd_hda_codec_resume_amp(codec); |
| 3777 | snd_hda_codec_resume_cache(codec); |
| 3778 | return 0; |
| 3779 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3780 | #endif |
| 3781 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3782 | /* |
| 3783 | */ |
| 3784 | static struct hda_codec_ops alc_patch_ops = { |
| 3785 | .build_controls = alc_build_controls, |
| 3786 | .build_pcms = alc_build_pcms, |
| 3787 | .init = alc_init, |
| 3788 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3789 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3790 | #ifdef SND_HDA_NEEDS_RESUME |
| 3791 | .resume = alc_resume, |
| 3792 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3793 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3794 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3795 | .check_power_status = alc_check_power_status, |
| 3796 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3797 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3798 | }; |
| 3799 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3800 | |
| 3801 | /* |
| 3802 | * Test configuration for debugging |
| 3803 | * |
| 3804 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3805 | * enum controls. |
| 3806 | */ |
| 3807 | #ifdef CONFIG_SND_DEBUG |
| 3808 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3809 | 0x02, 0x03, 0x04, 0x05 |
| 3810 | }; |
| 3811 | |
| 3812 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3813 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3814 | .items = { |
| 3815 | { "In-1", 0x0 }, |
| 3816 | { "In-2", 0x1 }, |
| 3817 | { "In-3", 0x2 }, |
| 3818 | { "In-4", 0x3 }, |
| 3819 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3820 | { "Front", 0x5 }, |
| 3821 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3822 | }, |
| 3823 | }; |
| 3824 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3825 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3826 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3827 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3828 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3829 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3830 | }; |
| 3831 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3832 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3833 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3834 | { |
| 3835 | static char *texts[] = { |
| 3836 | "N/A", "Line Out", "HP Out", |
| 3837 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3838 | }; |
| 3839 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3840 | uinfo->count = 1; |
| 3841 | uinfo->value.enumerated.items = 8; |
| 3842 | if (uinfo->value.enumerated.item >= 8) |
| 3843 | uinfo->value.enumerated.item = 7; |
| 3844 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3845 | return 0; |
| 3846 | } |
| 3847 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3848 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3849 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3850 | { |
| 3851 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3852 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3853 | unsigned int pin_ctl, item = 0; |
| 3854 | |
| 3855 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3856 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3857 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3858 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3859 | item = 2; |
| 3860 | else |
| 3861 | item = 1; |
| 3862 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3863 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3864 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3865 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3866 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3867 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3868 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3869 | } |
| 3870 | } |
| 3871 | ucontrol->value.enumerated.item[0] = item; |
| 3872 | return 0; |
| 3873 | } |
| 3874 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3875 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3876 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3877 | { |
| 3878 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3879 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3880 | static unsigned int ctls[] = { |
| 3881 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3882 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3883 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3884 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3885 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3886 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3887 | }; |
| 3888 | unsigned int old_ctl, new_ctl; |
| 3889 | |
| 3890 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3891 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3892 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3893 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3894 | int val; |
| 3895 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3896 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3897 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3898 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3899 | HDA_AMP_MUTE : 0; |
| 3900 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3901 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3902 | return 1; |
| 3903 | } |
| 3904 | return 0; |
| 3905 | } |
| 3906 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3907 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3908 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3909 | { |
| 3910 | static char *texts[] = { |
| 3911 | "Front", "Surround", "CLFE", "Side" |
| 3912 | }; |
| 3913 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3914 | uinfo->count = 1; |
| 3915 | uinfo->value.enumerated.items = 4; |
| 3916 | if (uinfo->value.enumerated.item >= 4) |
| 3917 | uinfo->value.enumerated.item = 3; |
| 3918 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3919 | return 0; |
| 3920 | } |
| 3921 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3922 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3923 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3924 | { |
| 3925 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3926 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3927 | unsigned int sel; |
| 3928 | |
| 3929 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3930 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3931 | return 0; |
| 3932 | } |
| 3933 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3934 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3935 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3936 | { |
| 3937 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3938 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3939 | unsigned int sel; |
| 3940 | |
| 3941 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3942 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3943 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3944 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3945 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3946 | return 1; |
| 3947 | } |
| 3948 | return 0; |
| 3949 | } |
| 3950 | |
| 3951 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3952 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3953 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3954 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3955 | .info = alc_test_pin_ctl_info, \ |
| 3956 | .get = alc_test_pin_ctl_get, \ |
| 3957 | .put = alc_test_pin_ctl_put, \ |
| 3958 | .private_value = nid \ |
| 3959 | } |
| 3960 | |
| 3961 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3962 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3963 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3964 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3965 | .info = alc_test_pin_src_info, \ |
| 3966 | .get = alc_test_pin_src_get, \ |
| 3967 | .put = alc_test_pin_src_put, \ |
| 3968 | .private_value = nid \ |
| 3969 | } |
| 3970 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3971 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3972 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3973 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3974 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3975 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3976 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3977 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3978 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3979 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3980 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3981 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3982 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3983 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3984 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3985 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3986 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3987 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3988 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3989 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3990 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3991 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3992 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3993 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3994 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3995 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3996 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3997 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3998 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3999 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4000 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4001 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4002 | { |
| 4003 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4004 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4005 | .info = alc_ch_mode_info, |
| 4006 | .get = alc_ch_mode_get, |
| 4007 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4008 | }, |
| 4009 | { } /* end */ |
| 4010 | }; |
| 4011 | |
| 4012 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4013 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4014 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4015 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4016 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4017 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4018 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4019 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4020 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4021 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4022 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4023 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4024 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4025 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4026 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4027 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4028 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4029 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4030 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4031 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4032 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4033 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4034 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4035 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4036 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4037 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4038 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4039 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4040 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4041 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4042 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4043 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4044 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4045 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4046 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4047 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4048 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4049 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4050 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4051 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4052 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4053 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4054 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4055 | /* Analog input/passthru */ |
| 4056 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4057 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4058 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4059 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4060 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4061 | { } |
| 4062 | }; |
| 4063 | #endif |
| 4064 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4065 | /* |
| 4066 | */ |
| 4067 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4068 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 4069 | [ALC880_3ST] = "3stack", |
| 4070 | [ALC880_TCL_S700] = "tcl", |
| 4071 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4072 | [ALC880_CLEVO] = "clevo", |
| 4073 | [ALC880_5ST] = "5stack", |
| 4074 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4075 | [ALC880_W810] = "w810", |
| 4076 | [ALC880_Z71V] = "z71v", |
| 4077 | [ALC880_6ST] = "6stack", |
| 4078 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4079 | [ALC880_ASUS] = "asus", |
| 4080 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4081 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4082 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4083 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4084 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4085 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4086 | [ALC880_F1734] = "F1734", |
| 4087 | [ALC880_LG] = "lg", |
| 4088 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4089 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4090 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4091 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4092 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4093 | [ALC880_AUTO] = "auto", |
| 4094 | }; |
| 4095 | |
| 4096 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4097 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4098 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4099 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4100 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4101 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4102 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4103 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4104 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4105 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4106 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4107 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4108 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4109 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4110 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4111 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4112 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4113 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4114 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4115 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4116 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4117 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4118 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4119 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4120 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4121 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4122 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4123 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4124 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4125 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4126 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4127 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4128 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4129 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4130 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4131 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4132 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4133 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4134 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4135 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4136 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4137 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4138 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4139 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4140 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4141 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4142 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4143 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4144 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4145 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4146 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4147 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4148 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4149 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 4150 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4151 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4152 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4153 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4154 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4155 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4156 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4157 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4158 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4159 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4160 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4161 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4162 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4163 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4164 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4165 | /* default Intel */ |
| 4166 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4167 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4168 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4169 | {} |
| 4170 | }; |
| 4171 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4172 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4173 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4174 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4175 | static struct alc_config_preset alc880_presets[] = { |
| 4176 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4177 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4178 | .init_verbs = { alc880_volume_init_verbs, |
| 4179 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4180 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4181 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4182 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4183 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4184 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4185 | .input_mux = &alc880_capture_source, |
| 4186 | }, |
| 4187 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4188 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4189 | .init_verbs = { alc880_volume_init_verbs, |
| 4190 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4191 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4192 | .dac_nids = alc880_dac_nids, |
| 4193 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4194 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4195 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4196 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4197 | .input_mux = &alc880_capture_source, |
| 4198 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4199 | [ALC880_TCL_S700] = { |
| 4200 | .mixers = { alc880_tcl_s700_mixer }, |
| 4201 | .init_verbs = { alc880_volume_init_verbs, |
| 4202 | alc880_pin_tcl_S700_init_verbs, |
| 4203 | alc880_gpio2_init_verbs }, |
| 4204 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4205 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4206 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4207 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4208 | .hp_nid = 0x03, |
| 4209 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4210 | .channel_mode = alc880_2_jack_modes, |
| 4211 | .input_mux = &alc880_capture_source, |
| 4212 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4213 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4214 | .mixers = { alc880_three_stack_mixer, |
| 4215 | alc880_five_stack_mixer}, |
| 4216 | .init_verbs = { alc880_volume_init_verbs, |
| 4217 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4218 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4219 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4220 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4221 | .channel_mode = alc880_fivestack_modes, |
| 4222 | .input_mux = &alc880_capture_source, |
| 4223 | }, |
| 4224 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4225 | .mixers = { alc880_three_stack_mixer, |
| 4226 | alc880_five_stack_mixer }, |
| 4227 | .init_verbs = { alc880_volume_init_verbs, |
| 4228 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4229 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4230 | .dac_nids = alc880_dac_nids, |
| 4231 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4232 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4233 | .channel_mode = alc880_fivestack_modes, |
| 4234 | .input_mux = &alc880_capture_source, |
| 4235 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4236 | [ALC880_6ST] = { |
| 4237 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4238 | .init_verbs = { alc880_volume_init_verbs, |
| 4239 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4240 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4241 | .dac_nids = alc880_6st_dac_nids, |
| 4242 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4243 | .channel_mode = alc880_sixstack_modes, |
| 4244 | .input_mux = &alc880_6stack_capture_source, |
| 4245 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4246 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4247 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4248 | .init_verbs = { alc880_volume_init_verbs, |
| 4249 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4250 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4251 | .dac_nids = alc880_6st_dac_nids, |
| 4252 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4253 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4254 | .channel_mode = alc880_sixstack_modes, |
| 4255 | .input_mux = &alc880_6stack_capture_source, |
| 4256 | }, |
| 4257 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4258 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4259 | .init_verbs = { alc880_volume_init_verbs, |
| 4260 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4261 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4262 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4263 | .dac_nids = alc880_w810_dac_nids, |
| 4264 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4265 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4266 | .channel_mode = alc880_w810_modes, |
| 4267 | .input_mux = &alc880_capture_source, |
| 4268 | }, |
| 4269 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4270 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4271 | .init_verbs = { alc880_volume_init_verbs, |
| 4272 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4273 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4274 | .dac_nids = alc880_z71v_dac_nids, |
| 4275 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4276 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4277 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4278 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4279 | .input_mux = &alc880_capture_source, |
| 4280 | }, |
| 4281 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4282 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4283 | .init_verbs = { alc880_volume_init_verbs, |
| 4284 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4285 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4286 | .dac_nids = alc880_f1734_dac_nids, |
| 4287 | .hp_nid = 0x02, |
| 4288 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4289 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4290 | .input_mux = &alc880_f1734_capture_source, |
| 4291 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4292 | .setup = alc880_uniwill_p53_setup, |
| 4293 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4294 | }, |
| 4295 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4296 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4297 | .init_verbs = { alc880_volume_init_verbs, |
| 4298 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4299 | alc880_gpio1_init_verbs }, |
| 4300 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4301 | .dac_nids = alc880_asus_dac_nids, |
| 4302 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4303 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4304 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4305 | .input_mux = &alc880_capture_source, |
| 4306 | }, |
| 4307 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4308 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4309 | .init_verbs = { alc880_volume_init_verbs, |
| 4310 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4311 | alc880_gpio1_init_verbs }, |
| 4312 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4313 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4314 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4315 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4316 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4317 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4318 | .input_mux = &alc880_capture_source, |
| 4319 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4320 | [ALC880_ASUS_DIG2] = { |
| 4321 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4322 | .init_verbs = { alc880_volume_init_verbs, |
| 4323 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4324 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4325 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4326 | .dac_nids = alc880_asus_dac_nids, |
| 4327 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4328 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4329 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4330 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4331 | .input_mux = &alc880_capture_source, |
| 4332 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4333 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4334 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4335 | .init_verbs = { alc880_volume_init_verbs, |
| 4336 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4337 | alc880_gpio1_init_verbs }, |
| 4338 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4339 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4340 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4341 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4342 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4343 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4344 | .input_mux = &alc880_capture_source, |
| 4345 | }, |
| 4346 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4347 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4348 | .init_verbs = { alc880_volume_init_verbs, |
| 4349 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4350 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4351 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4352 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4353 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4354 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4355 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4356 | .input_mux = &alc880_capture_source, |
| 4357 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4358 | [ALC880_UNIWILL] = { |
| 4359 | .mixers = { alc880_uniwill_mixer }, |
| 4360 | .init_verbs = { alc880_volume_init_verbs, |
| 4361 | alc880_uniwill_init_verbs }, |
| 4362 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4363 | .dac_nids = alc880_asus_dac_nids, |
| 4364 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4365 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4366 | .channel_mode = alc880_threestack_modes, |
| 4367 | .need_dac_fix = 1, |
| 4368 | .input_mux = &alc880_capture_source, |
| 4369 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4370 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4371 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4372 | }, |
| 4373 | [ALC880_UNIWILL_P53] = { |
| 4374 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4375 | .init_verbs = { alc880_volume_init_verbs, |
| 4376 | alc880_uniwill_p53_init_verbs }, |
| 4377 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4378 | .dac_nids = alc880_asus_dac_nids, |
| 4379 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4380 | .channel_mode = alc880_threestack_modes, |
| 4381 | .input_mux = &alc880_capture_source, |
| 4382 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4383 | .setup = alc880_uniwill_p53_setup, |
| 4384 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4385 | }, |
| 4386 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4387 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4388 | .init_verbs = { alc880_volume_init_verbs, |
| 4389 | alc880_uniwill_p53_init_verbs, |
| 4390 | alc880_beep_init_verbs }, |
| 4391 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4392 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4393 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4394 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4395 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4396 | .input_mux = &alc880_capture_source, |
| 4397 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4398 | .setup = alc880_uniwill_p53_setup, |
| 4399 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4400 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4401 | [ALC880_CLEVO] = { |
| 4402 | .mixers = { alc880_three_stack_mixer }, |
| 4403 | .init_verbs = { alc880_volume_init_verbs, |
| 4404 | alc880_pin_clevo_init_verbs }, |
| 4405 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4406 | .dac_nids = alc880_dac_nids, |
| 4407 | .hp_nid = 0x03, |
| 4408 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4409 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4410 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4411 | .input_mux = &alc880_capture_source, |
| 4412 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4413 | [ALC880_LG] = { |
| 4414 | .mixers = { alc880_lg_mixer }, |
| 4415 | .init_verbs = { alc880_volume_init_verbs, |
| 4416 | alc880_lg_init_verbs }, |
| 4417 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4418 | .dac_nids = alc880_lg_dac_nids, |
| 4419 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4420 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4421 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4422 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4423 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4424 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4425 | .setup = alc880_lg_setup, |
| 4426 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4427 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4428 | .loopbacks = alc880_lg_loopbacks, |
| 4429 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4430 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4431 | [ALC880_LG_LW] = { |
| 4432 | .mixers = { alc880_lg_lw_mixer }, |
| 4433 | .init_verbs = { alc880_volume_init_verbs, |
| 4434 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4435 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4436 | .dac_nids = alc880_dac_nids, |
| 4437 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4438 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4439 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4440 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4441 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4442 | .setup = alc880_lg_lw_setup, |
| 4443 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4444 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4445 | [ALC880_MEDION_RIM] = { |
| 4446 | .mixers = { alc880_medion_rim_mixer }, |
| 4447 | .init_verbs = { alc880_volume_init_verbs, |
| 4448 | alc880_medion_rim_init_verbs, |
| 4449 | alc_gpio2_init_verbs }, |
| 4450 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4451 | .dac_nids = alc880_dac_nids, |
| 4452 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4453 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4454 | .channel_mode = alc880_2_jack_modes, |
| 4455 | .input_mux = &alc880_medion_rim_capture_source, |
| 4456 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4457 | .setup = alc880_medion_rim_setup, |
| 4458 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4459 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4460 | #ifdef CONFIG_SND_DEBUG |
| 4461 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4462 | .mixers = { alc880_test_mixer }, |
| 4463 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4464 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4465 | .dac_nids = alc880_test_dac_nids, |
| 4466 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4467 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4468 | .channel_mode = alc880_test_modes, |
| 4469 | .input_mux = &alc880_test_capture_source, |
| 4470 | }, |
| 4471 | #endif |
| 4472 | }; |
| 4473 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4474 | /* |
| 4475 | * Automatic parse of I/O pins from the BIOS configuration |
| 4476 | */ |
| 4477 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4478 | enum { |
| 4479 | ALC_CTL_WIDGET_VOL, |
| 4480 | ALC_CTL_WIDGET_MUTE, |
| 4481 | ALC_CTL_BIND_MUTE, |
| 4482 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4483 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4484 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4485 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4486 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4487 | }; |
| 4488 | |
| 4489 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4490 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4491 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4492 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4493 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4494 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4495 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4496 | knew = snd_array_new(&spec->kctls); |
| 4497 | if (!knew) |
| 4498 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4499 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4500 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4501 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4502 | return -ENOMEM; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 4503 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 4504 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4505 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4506 | return 0; |
| 4507 | } |
| 4508 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4509 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 4510 | const char *pfx, const char *dir, |
| 4511 | const char *sfx, unsigned long val) |
| 4512 | { |
| 4513 | char name[32]; |
| 4514 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
| 4515 | return add_control(spec, type, name, val); |
| 4516 | } |
| 4517 | |
| 4518 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 4519 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val) |
| 4520 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 4521 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val) |
| 4522 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4523 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4524 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4525 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4526 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4527 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4528 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4529 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4530 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4531 | #define ALC880_PIN_CD_NID 0x1c |
| 4532 | |
| 4533 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4534 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4535 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4536 | { |
| 4537 | hda_nid_t nid; |
| 4538 | int assigned[4]; |
| 4539 | int i, j; |
| 4540 | |
| 4541 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4542 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4543 | |
| 4544 | /* check the pins hardwired to audio widget */ |
| 4545 | for (i = 0; i < cfg->line_outs; i++) { |
| 4546 | nid = cfg->line_out_pins[i]; |
| 4547 | if (alc880_is_fixed_pin(nid)) { |
| 4548 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4549 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4550 | assigned[idx] = 1; |
| 4551 | } |
| 4552 | } |
| 4553 | /* left pins can be connect to any audio widget */ |
| 4554 | for (i = 0; i < cfg->line_outs; i++) { |
| 4555 | nid = cfg->line_out_pins[i]; |
| 4556 | if (alc880_is_fixed_pin(nid)) |
| 4557 | continue; |
| 4558 | /* search for an empty channel */ |
| 4559 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4560 | if (!assigned[j]) { |
| 4561 | spec->multiout.dac_nids[i] = |
| 4562 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4563 | assigned[j] = 1; |
| 4564 | break; |
| 4565 | } |
| 4566 | } |
| 4567 | } |
| 4568 | spec->multiout.num_dacs = cfg->line_outs; |
| 4569 | return 0; |
| 4570 | } |
| 4571 | |
| 4572 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4573 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4574 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4575 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4576 | static const char *chname[4] = { |
| 4577 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4578 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4579 | hda_nid_t nid; |
| 4580 | int i, err; |
| 4581 | |
| 4582 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4583 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4584 | continue; |
| 4585 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4586 | if (i == 2) { |
| 4587 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4588 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4589 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4590 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4591 | HDA_OUTPUT)); |
| 4592 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4593 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4594 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4595 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4596 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4597 | HDA_OUTPUT)); |
| 4598 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4599 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4600 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4601 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4602 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4603 | HDA_INPUT)); |
| 4604 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4605 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4606 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4607 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4608 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4609 | HDA_INPUT)); |
| 4610 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4611 | return err; |
| 4612 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4613 | const char *pfx; |
| 4614 | if (cfg->line_outs == 1 && |
| 4615 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 4616 | pfx = "Speaker"; |
| 4617 | else |
| 4618 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4619 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4620 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4621 | HDA_OUTPUT)); |
| 4622 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4623 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4624 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4625 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4626 | HDA_INPUT)); |
| 4627 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4628 | return err; |
| 4629 | } |
| 4630 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4631 | return 0; |
| 4632 | } |
| 4633 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4634 | /* add playback controls for speaker and HP outputs */ |
| 4635 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4636 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4637 | { |
| 4638 | hda_nid_t nid; |
| 4639 | int err; |
| 4640 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4641 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4642 | return 0; |
| 4643 | |
| 4644 | if (alc880_is_fixed_pin(pin)) { |
| 4645 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4646 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4647 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4648 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4649 | else |
| 4650 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4651 | /* control HP volume/switch on the output mixer amp */ |
| 4652 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4653 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4654 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4655 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4656 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4657 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4658 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4659 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4660 | return err; |
| 4661 | } else if (alc880_is_multi_pin(pin)) { |
| 4662 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4663 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4664 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4665 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4666 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4667 | return err; |
| 4668 | } |
| 4669 | return 0; |
| 4670 | } |
| 4671 | |
| 4672 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4673 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4674 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4675 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4676 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4677 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4678 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4679 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4680 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4681 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4682 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4683 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4684 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4685 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4686 | return err; |
| 4687 | return 0; |
| 4688 | } |
| 4689 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4690 | 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] | 4691 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4692 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 4693 | return (pincap & AC_PINCAP_IN) != 0; |
| 4694 | } |
| 4695 | |
| 4696 | /* create playback/capture controls for input pins */ |
| 4697 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 4698 | const struct auto_pin_cfg *cfg, |
| 4699 | hda_nid_t mixer, |
| 4700 | hda_nid_t cap1, hda_nid_t cap2) |
| 4701 | { |
| 4702 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4703 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4704 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4705 | |
| 4706 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4707 | hda_nid_t pin; |
| 4708 | |
| 4709 | pin = cfg->input_pins[i]; |
| 4710 | if (!alc_is_input_pin(codec, pin)) |
| 4711 | continue; |
| 4712 | |
| 4713 | if (mixer) { |
| 4714 | idx = get_connection_index(codec, mixer, pin); |
| 4715 | if (idx >= 0) { |
| 4716 | err = new_analog_input(spec, pin, |
| 4717 | auto_pin_cfg_labels[i], |
| 4718 | idx, mixer); |
| 4719 | if (err < 0) |
| 4720 | return err; |
| 4721 | } |
| 4722 | } |
| 4723 | |
| 4724 | if (!cap1) |
| 4725 | continue; |
| 4726 | idx = get_connection_index(codec, cap1, pin); |
| 4727 | if (idx < 0 && cap2) |
| 4728 | idx = get_connection_index(codec, cap2, pin); |
| 4729 | if (idx >= 0) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4730 | imux->items[imux->num_items].label = |
| 4731 | auto_pin_cfg_labels[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4732 | imux->items[imux->num_items].index = idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4733 | imux->num_items++; |
| 4734 | } |
| 4735 | } |
| 4736 | return 0; |
| 4737 | } |
| 4738 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4739 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 4740 | const struct auto_pin_cfg *cfg) |
| 4741 | { |
| 4742 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 4743 | } |
| 4744 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4745 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4746 | unsigned int pin_type) |
| 4747 | { |
| 4748 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4749 | pin_type); |
| 4750 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4751 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4752 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4753 | } |
| 4754 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4755 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4756 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4757 | int dac_idx) |
| 4758 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4759 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4760 | /* need the manual connection? */ |
| 4761 | if (alc880_is_multi_pin(nid)) { |
| 4762 | struct alc_spec *spec = codec->spec; |
| 4763 | int idx = alc880_multi_pin_idx(nid); |
| 4764 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4765 | AC_VERB_SET_CONNECT_SEL, |
| 4766 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4767 | } |
| 4768 | } |
| 4769 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4770 | static int get_pin_type(int line_out_type) |
| 4771 | { |
| 4772 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4773 | return PIN_HP; |
| 4774 | else |
| 4775 | return PIN_OUT; |
| 4776 | } |
| 4777 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4778 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4779 | { |
| 4780 | struct alc_spec *spec = codec->spec; |
| 4781 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4782 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4783 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4784 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4785 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4786 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4787 | } |
| 4788 | } |
| 4789 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4790 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4791 | { |
| 4792 | struct alc_spec *spec = codec->spec; |
| 4793 | hda_nid_t pin; |
| 4794 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4795 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4796 | if (pin) /* connect to front */ |
| 4797 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4798 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4799 | if (pin) /* connect to front */ |
| 4800 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4801 | } |
| 4802 | |
| 4803 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4804 | { |
| 4805 | struct alc_spec *spec = codec->spec; |
| 4806 | int i; |
| 4807 | |
| 4808 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4809 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4810 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4811 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4812 | if (nid != ALC880_PIN_CD_NID && |
| 4813 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4814 | snd_hda_codec_write(codec, nid, 0, |
| 4815 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4816 | AMP_OUT_MUTE); |
| 4817 | } |
| 4818 | } |
| 4819 | } |
| 4820 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 4821 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 4822 | { |
| 4823 | struct alc_spec *spec = codec->spec; |
| 4824 | int c; |
| 4825 | |
| 4826 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 4827 | unsigned int mux_idx; |
| 4828 | const struct hda_input_mux *imux; |
| 4829 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 4830 | imux = &spec->input_mux[mux_idx]; |
| 4831 | if (!imux->num_items && mux_idx > 0) |
| 4832 | imux = &spec->input_mux[0]; |
| 4833 | if (imux) |
| 4834 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 4835 | AC_VERB_SET_CONNECT_SEL, |
| 4836 | imux->items[0].index); |
| 4837 | } |
| 4838 | } |
| 4839 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4840 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4841 | /* return 1 if successful, 0 if the proper config is not found, |
| 4842 | * or a negative error code |
| 4843 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4844 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4845 | { |
| 4846 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4847 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4848 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4849 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4850 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4851 | alc880_ignore); |
| 4852 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4853 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4854 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4855 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4856 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4857 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4858 | if (err < 0) |
| 4859 | return err; |
| 4860 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4861 | if (err < 0) |
| 4862 | return err; |
| 4863 | err = alc880_auto_create_extra_out(spec, |
| 4864 | spec->autocfg.speaker_pins[0], |
| 4865 | "Speaker"); |
| 4866 | if (err < 0) |
| 4867 | return err; |
| 4868 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4869 | "Headphone"); |
| 4870 | if (err < 0) |
| 4871 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4872 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4873 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4874 | return err; |
| 4875 | |
| 4876 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4877 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4878 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4879 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4880 | hda_nid_t dig_nid; |
| 4881 | err = snd_hda_get_connections(codec, |
| 4882 | spec->autocfg.dig_out_pins[i], |
| 4883 | &dig_nid, 1); |
| 4884 | if (err < 0) |
| 4885 | continue; |
| 4886 | if (!i) |
| 4887 | spec->multiout.dig_out_nid = dig_nid; |
| 4888 | else { |
| 4889 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 4890 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4891 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 4892 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4893 | } |
| 4894 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4895 | if (spec->autocfg.dig_in_pin) |
| 4896 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4897 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4898 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4899 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4900 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4901 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4902 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4903 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4904 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4905 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 4906 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4907 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4908 | return 1; |
| 4909 | } |
| 4910 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4911 | /* additional initialization for auto-configuration model */ |
| 4912 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4913 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4914 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4915 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4916 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4917 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 4918 | alc880_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4919 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4920 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4921 | } |
| 4922 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4923 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 4924 | * one of two digital mic pins, e.g. on ALC272 |
| 4925 | */ |
| 4926 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4927 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4928 | struct alc_spec *spec = codec->spec; |
| 4929 | int i; |
| 4930 | |
| 4931 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 4932 | hda_nid_t cap = spec->capsrc_nids ? |
| 4933 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 4934 | int iidx, eidx; |
| 4935 | |
| 4936 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 4937 | if (iidx < 0) |
| 4938 | continue; |
| 4939 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 4940 | if (eidx < 0) |
| 4941 | continue; |
| 4942 | spec->int_mic.mux_idx = iidx; |
| 4943 | spec->ext_mic.mux_idx = eidx; |
| 4944 | if (spec->capsrc_nids) |
| 4945 | spec->capsrc_nids += i; |
| 4946 | spec->adc_nids += i; |
| 4947 | spec->num_adc_nids = 1; |
| 4948 | return; |
| 4949 | } |
| 4950 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 4951 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 4952 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 4953 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 4954 | } |
| 4955 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 4956 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 4957 | static void fixup_single_adc(struct hda_codec *codec) |
| 4958 | { |
| 4959 | struct alc_spec *spec = codec->spec; |
Frederik Deweerdt | d2db09b | 2010-03-05 16:34:31 +0100 | [diff] [blame] | 4960 | hda_nid_t pin = 0; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 4961 | int i; |
| 4962 | |
| 4963 | /* search for the input pin; there must be only one */ |
| 4964 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4965 | if (spec->autocfg.input_pins[i]) { |
| 4966 | pin = spec->autocfg.input_pins[i]; |
| 4967 | break; |
| 4968 | } |
| 4969 | } |
| 4970 | if (!pin) |
| 4971 | return; |
| 4972 | |
| 4973 | /* set the default connection to that pin */ |
| 4974 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 4975 | hda_nid_t cap = spec->capsrc_nids ? |
| 4976 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 4977 | int idx; |
| 4978 | |
| 4979 | idx = get_connection_index(codec, cap, pin); |
| 4980 | if (idx < 0) |
| 4981 | continue; |
| 4982 | /* use only this ADC */ |
| 4983 | if (spec->capsrc_nids) |
| 4984 | spec->capsrc_nids += i; |
| 4985 | spec->adc_nids += i; |
| 4986 | spec->num_adc_nids = 1; |
| 4987 | /* select or unmute this route */ |
| 4988 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 4989 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 4990 | HDA_AMP_MUTE, 0); |
| 4991 | } else { |
| 4992 | snd_hda_codec_write_cache(codec, cap, 0, |
| 4993 | AC_VERB_SET_CONNECT_SEL, idx); |
| 4994 | } |
| 4995 | return; |
| 4996 | } |
| 4997 | } |
| 4998 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4999 | static void set_capture_mixer(struct hda_codec *codec) |
| 5000 | { |
| 5001 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5002 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5003 | { alc_capture_mixer_nosrc1, |
| 5004 | alc_capture_mixer_nosrc2, |
| 5005 | alc_capture_mixer_nosrc3 }, |
| 5006 | { alc_capture_mixer1, |
| 5007 | alc_capture_mixer2, |
| 5008 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5009 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5010 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5011 | int mux = 0; |
| 5012 | if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5013 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5014 | else if (spec->input_mux) { |
| 5015 | if (spec->input_mux->num_items > 1) |
| 5016 | mux = 1; |
| 5017 | else if (spec->input_mux->num_items == 1) |
| 5018 | fixup_single_adc(codec); |
| 5019 | } |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5020 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 5021 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5022 | } |
| 5023 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5024 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5025 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5026 | int num_nids) |
| 5027 | { |
| 5028 | struct alc_spec *spec = codec->spec; |
| 5029 | int n; |
| 5030 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5031 | |
| 5032 | for (n = 0; n < num_nids; n++) { |
| 5033 | hda_nid_t adc, cap; |
| 5034 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5035 | int nconns, i, j; |
| 5036 | |
| 5037 | adc = nids[n]; |
| 5038 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5039 | continue; |
| 5040 | cap = adc; |
| 5041 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5042 | ARRAY_SIZE(conn)); |
| 5043 | if (nconns == 1) { |
| 5044 | cap = conn[0]; |
| 5045 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5046 | ARRAY_SIZE(conn)); |
| 5047 | } |
| 5048 | if (nconns <= 0) |
| 5049 | continue; |
| 5050 | if (!fallback_adc) { |
| 5051 | fallback_adc = adc; |
| 5052 | fallback_cap = cap; |
| 5053 | } |
| 5054 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5055 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5056 | if (!nid) |
| 5057 | continue; |
| 5058 | for (j = 0; j < nconns; j++) { |
| 5059 | if (conn[j] == nid) |
| 5060 | break; |
| 5061 | } |
| 5062 | if (j >= nconns) |
| 5063 | break; |
| 5064 | } |
| 5065 | if (i >= AUTO_PIN_LAST) { |
| 5066 | int num_adcs = spec->num_adc_nids; |
| 5067 | spec->private_adc_nids[num_adcs] = adc; |
| 5068 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5069 | spec->num_adc_nids++; |
| 5070 | spec->adc_nids = spec->private_adc_nids; |
| 5071 | if (adc != cap) |
| 5072 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5073 | } |
| 5074 | } |
| 5075 | if (!spec->num_adc_nids) { |
| 5076 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5077 | " using fallback 0x%x\n", |
| 5078 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5079 | spec->private_adc_nids[0] = fallback_adc; |
| 5080 | spec->adc_nids = spec->private_adc_nids; |
| 5081 | if (fallback_adc != fallback_cap) { |
| 5082 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5083 | spec->capsrc_nids = spec->private_adc_nids; |
| 5084 | } |
| 5085 | } |
| 5086 | } |
| 5087 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5088 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5089 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5090 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5091 | #else |
| 5092 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
| 5093 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5094 | |
| 5095 | /* |
| 5096 | * OK, here we have finally the patch for ALC880 |
| 5097 | */ |
| 5098 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5099 | static int patch_alc880(struct hda_codec *codec) |
| 5100 | { |
| 5101 | struct alc_spec *spec; |
| 5102 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5103 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5104 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5105 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5106 | if (spec == NULL) |
| 5107 | return -ENOMEM; |
| 5108 | |
| 5109 | codec->spec = spec; |
| 5110 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5111 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5112 | alc880_models, |
| 5113 | alc880_cfg_tbl); |
| 5114 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5115 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5116 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5117 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5118 | } |
| 5119 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5120 | if (board_config == ALC880_AUTO) { |
| 5121 | /* automatic parse from the BIOS config */ |
| 5122 | err = alc880_parse_auto_config(codec); |
| 5123 | if (err < 0) { |
| 5124 | alc_free(codec); |
| 5125 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5126 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5127 | printk(KERN_INFO |
| 5128 | "hda_codec: Cannot set up configuration " |
| 5129 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5130 | board_config = ALC880_3ST; |
| 5131 | } |
| 5132 | } |
| 5133 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5134 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5135 | if (err < 0) { |
| 5136 | alc_free(codec); |
| 5137 | return err; |
| 5138 | } |
| 5139 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5140 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5141 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5142 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5143 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5144 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5145 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5146 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5147 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5148 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5149 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5150 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5151 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5152 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5153 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5154 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5155 | if (wcap != AC_WID_AUD_IN) { |
| 5156 | spec->adc_nids = alc880_adc_nids_alt; |
| 5157 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5158 | } else { |
| 5159 | spec->adc_nids = alc880_adc_nids; |
| 5160 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5161 | } |
| 5162 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5163 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5164 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5165 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5166 | spec->vmaster_nid = 0x0c; |
| 5167 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5168 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5169 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5170 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5171 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5172 | if (!spec->loopback.amplist) |
| 5173 | spec->loopback.amplist = alc880_loopbacks; |
| 5174 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5175 | |
| 5176 | return 0; |
| 5177 | } |
| 5178 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5179 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5180 | /* |
| 5181 | * ALC260 support |
| 5182 | */ |
| 5183 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5184 | static hda_nid_t alc260_dac_nids[1] = { |
| 5185 | /* front */ |
| 5186 | 0x02, |
| 5187 | }; |
| 5188 | |
| 5189 | static hda_nid_t alc260_adc_nids[1] = { |
| 5190 | /* ADC0 */ |
| 5191 | 0x04, |
| 5192 | }; |
| 5193 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5194 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5195 | /* ADC1 */ |
| 5196 | 0x05, |
| 5197 | }; |
| 5198 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5199 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5200 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5201 | */ |
| 5202 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5203 | /* ADC0, ADC1 */ |
| 5204 | 0x04, 0x05 |
| 5205 | }; |
| 5206 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5207 | #define ALC260_DIGOUT_NID 0x03 |
| 5208 | #define ALC260_DIGIN_NID 0x06 |
| 5209 | |
| 5210 | static struct hda_input_mux alc260_capture_source = { |
| 5211 | .num_items = 4, |
| 5212 | .items = { |
| 5213 | { "Mic", 0x0 }, |
| 5214 | { "Front Mic", 0x1 }, |
| 5215 | { "Line", 0x2 }, |
| 5216 | { "CD", 0x4 }, |
| 5217 | }, |
| 5218 | }; |
| 5219 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5220 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5221 | * headphone jack and the internal CD lines since these are the only pins at |
| 5222 | * which audio can appear. For flexibility, also allow the option of |
| 5223 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5224 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5225 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5226 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5227 | { |
| 5228 | .num_items = 3, |
| 5229 | .items = { |
| 5230 | { "Mic/Line", 0x0 }, |
| 5231 | { "CD", 0x4 }, |
| 5232 | { "Headphone", 0x2 }, |
| 5233 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5234 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5235 | { |
| 5236 | .num_items = 4, |
| 5237 | .items = { |
| 5238 | { "Mic/Line", 0x0 }, |
| 5239 | { "CD", 0x4 }, |
| 5240 | { "Headphone", 0x2 }, |
| 5241 | { "Mixer", 0x5 }, |
| 5242 | }, |
| 5243 | }, |
| 5244 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5245 | }; |
| 5246 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5247 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5248 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5249 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5250 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5251 | { |
| 5252 | .num_items = 4, |
| 5253 | .items = { |
| 5254 | { "Mic", 0x0 }, |
| 5255 | { "Line", 0x2 }, |
| 5256 | { "CD", 0x4 }, |
| 5257 | { "Headphone", 0x5 }, |
| 5258 | }, |
| 5259 | }, |
| 5260 | { |
| 5261 | .num_items = 5, |
| 5262 | .items = { |
| 5263 | { "Mic", 0x0 }, |
| 5264 | { "Line", 0x2 }, |
| 5265 | { "CD", 0x4 }, |
| 5266 | { "Headphone", 0x6 }, |
| 5267 | { "Mixer", 0x5 }, |
| 5268 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5269 | }, |
| 5270 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5271 | |
| 5272 | /* Maxdata Favorit 100XS */ |
| 5273 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5274 | { |
| 5275 | .num_items = 2, |
| 5276 | .items = { |
| 5277 | { "Line/Mic", 0x0 }, |
| 5278 | { "CD", 0x4 }, |
| 5279 | }, |
| 5280 | }, |
| 5281 | { |
| 5282 | .num_items = 3, |
| 5283 | .items = { |
| 5284 | { "Line/Mic", 0x0 }, |
| 5285 | { "CD", 0x4 }, |
| 5286 | { "Mixer", 0x5 }, |
| 5287 | }, |
| 5288 | }, |
| 5289 | }; |
| 5290 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5291 | /* |
| 5292 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5293 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5294 | * element which allows changing the channel mode, so the verb list is |
| 5295 | * never used. |
| 5296 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5297 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5298 | { 2, NULL }, |
| 5299 | }; |
| 5300 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5301 | |
| 5302 | /* Mixer combinations |
| 5303 | * |
| 5304 | * basic: base_output + input + pc_beep + capture |
| 5305 | * HP: base_output + input + capture_alt |
| 5306 | * HP_3013: hp_3013 + input + capture |
| 5307 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5308 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5309 | */ |
| 5310 | |
| 5311 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5312 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5313 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5314 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5315 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5316 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5317 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5318 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5319 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5320 | |
| 5321 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5322 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5323 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5324 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5325 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5326 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5327 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5328 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5329 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5330 | { } /* end */ |
| 5331 | }; |
| 5332 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5333 | /* update HP, line and mono out pins according to the master switch */ |
| 5334 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5335 | hda_nid_t hp, hda_nid_t line, |
| 5336 | hda_nid_t mono) |
| 5337 | { |
| 5338 | struct alc_spec *spec = codec->spec; |
| 5339 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5340 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5341 | 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] | 5342 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5343 | 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] | 5344 | val); |
| 5345 | /* mono (speaker) depending on the HP jack sense */ |
| 5346 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5347 | 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] | 5348 | val); |
| 5349 | } |
| 5350 | |
| 5351 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5352 | struct snd_ctl_elem_value *ucontrol) |
| 5353 | { |
| 5354 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5355 | struct alc_spec *spec = codec->spec; |
| 5356 | *ucontrol->value.integer.value = spec->master_sw; |
| 5357 | return 0; |
| 5358 | } |
| 5359 | |
| 5360 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5361 | struct snd_ctl_elem_value *ucontrol) |
| 5362 | { |
| 5363 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5364 | struct alc_spec *spec = codec->spec; |
| 5365 | int val = !!*ucontrol->value.integer.value; |
| 5366 | hda_nid_t hp, line, mono; |
| 5367 | |
| 5368 | if (val == spec->master_sw) |
| 5369 | return 0; |
| 5370 | spec->master_sw = val; |
| 5371 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5372 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5373 | mono = kcontrol->private_value & 0xff; |
| 5374 | alc260_hp_master_update(codec, hp, line, mono); |
| 5375 | return 1; |
| 5376 | } |
| 5377 | |
| 5378 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5379 | { |
| 5380 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5381 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5382 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5383 | .info = snd_ctl_boolean_mono_info, |
| 5384 | .get = alc260_hp_master_sw_get, |
| 5385 | .put = alc260_hp_master_sw_put, |
| 5386 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5387 | }, |
| 5388 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5389 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5390 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5391 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5392 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5393 | HDA_OUTPUT), |
| 5394 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5395 | { } /* end */ |
| 5396 | }; |
| 5397 | |
| 5398 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5399 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5400 | {}, |
| 5401 | }; |
| 5402 | |
| 5403 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5404 | { |
| 5405 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5406 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5407 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5408 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5409 | } |
| 5410 | |
| 5411 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5412 | { |
| 5413 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5414 | alc260_hp_automute(codec); |
| 5415 | } |
| 5416 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5417 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5418 | { |
| 5419 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5420 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5421 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5422 | .info = snd_ctl_boolean_mono_info, |
| 5423 | .get = alc260_hp_master_sw_get, |
| 5424 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5425 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5426 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5427 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5428 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5429 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5430 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5431 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5432 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5433 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5434 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5435 | { } /* end */ |
| 5436 | }; |
| 5437 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5438 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5439 | .ops = &snd_hda_bind_vol, |
| 5440 | .values = { |
| 5441 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5442 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5443 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5444 | 0 |
| 5445 | }, |
| 5446 | }; |
| 5447 | |
| 5448 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5449 | .ops = &snd_hda_bind_sw, |
| 5450 | .values = { |
| 5451 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5452 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5453 | 0 |
| 5454 | }, |
| 5455 | }; |
| 5456 | |
| 5457 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5458 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5459 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5460 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5461 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5462 | { } /* end */ |
| 5463 | }; |
| 5464 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5465 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5466 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5467 | {}, |
| 5468 | }; |
| 5469 | |
| 5470 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5471 | { |
| 5472 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5473 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5474 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5475 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5476 | } |
| 5477 | |
| 5478 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5479 | unsigned int res) |
| 5480 | { |
| 5481 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5482 | alc260_hp_3013_automute(codec); |
| 5483 | } |
| 5484 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5485 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5486 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5487 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5488 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5489 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5490 | bits); |
| 5491 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5492 | bits); |
| 5493 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5494 | bits); |
| 5495 | } |
| 5496 | |
| 5497 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5498 | unsigned int res) |
| 5499 | { |
| 5500 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5501 | alc260_hp_3012_automute(codec); |
| 5502 | } |
| 5503 | |
| 5504 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5505 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5506 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5507 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5508 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5509 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5510 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5511 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5512 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5513 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5514 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5515 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5516 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5517 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5518 | { } /* end */ |
| 5519 | }; |
| 5520 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5521 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5522 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5523 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5524 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5525 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5526 | * revisions available in early 2006. Therefore for now allow the |
| 5527 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5528 | * that the lack of mic bias for this NID is intentional we could change the |
| 5529 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5530 | * |
| 5531 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5532 | * don't appear to make the mic bias available from the "line" jack, even |
| 5533 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5534 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5535 | * and the output jack. If this turns out to be the case for all such |
| 5536 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5537 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5538 | * |
| 5539 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5540 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5541 | * controls for such models. On models without a "mono speaker" the control |
| 5542 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5543 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5544 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5545 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5546 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5547 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5548 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5549 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5550 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5551 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5552 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5553 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5554 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5555 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5556 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5557 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5558 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5559 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5560 | { } /* end */ |
| 5561 | }; |
| 5562 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5563 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5564 | */ |
| 5565 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5566 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5567 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5568 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5569 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5570 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5571 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5572 | { } /* end */ |
| 5573 | }; |
| 5574 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5575 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5576 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5577 | */ |
| 5578 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5579 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5580 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5581 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5582 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5583 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5584 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5585 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5586 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5587 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5588 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5589 | { } /* end */ |
| 5590 | }; |
| 5591 | |
| 5592 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5593 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5594 | */ |
| 5595 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5596 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5597 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5598 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5599 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5600 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5601 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5602 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5603 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5604 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5605 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5606 | { } /* end */ |
| 5607 | }; |
| 5608 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5609 | /* |
| 5610 | * initialization verbs |
| 5611 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5612 | static struct hda_verb alc260_init_verbs[] = { |
| 5613 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5614 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5615 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5616 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5617 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5618 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5619 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5620 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5621 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5622 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5623 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5624 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5625 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5626 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5627 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5628 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5629 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5630 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5631 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5632 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5633 | /* set connection select to line in (default select for this ADC) */ |
| 5634 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5635 | /* mute capture amp left and right */ |
| 5636 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5637 | /* set connection select to line in (default select for this ADC) */ |
| 5638 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5639 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5640 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5641 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5642 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5643 | /* set vol=0 HP mixer amp left and right */ |
| 5644 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5645 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5646 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5647 | /* set vol=0 Mono mixer amp left and right */ |
| 5648 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5649 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5650 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5651 | /* unmute LINE-2 out pin */ |
| 5652 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5653 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5654 | * Line In 2 = 0x03 |
| 5655 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5656 | /* mute analog inputs */ |
| 5657 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5658 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5659 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5660 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5661 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5662 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5663 | /* mute Front out path */ |
| 5664 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5665 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5666 | /* mute Headphone out path */ |
| 5667 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5668 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5669 | /* mute Mono out path */ |
| 5670 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5671 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5672 | { } |
| 5673 | }; |
| 5674 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5675 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5676 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5677 | /* Headphone and output */ |
| 5678 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5679 | /* mono output */ |
| 5680 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5681 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5682 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5683 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5684 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5685 | /* Line In pin widget for input */ |
| 5686 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5687 | /* Line-2 pin widget for output */ |
| 5688 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5689 | /* CD pin widget for input */ |
| 5690 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5691 | /* unmute amp left and right */ |
| 5692 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5693 | /* set connection select to line in (default select for this ADC) */ |
| 5694 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5695 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5696 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5697 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5698 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5699 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5700 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5701 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5702 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5703 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5704 | * Line In 2 = 0x03 |
| 5705 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5706 | /* mute analog inputs */ |
| 5707 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5708 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5709 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5710 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5711 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5712 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5713 | /* Unmute Front out path */ |
| 5714 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5715 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5716 | /* Unmute Headphone out path */ |
| 5717 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5718 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5719 | /* Unmute Mono out path */ |
| 5720 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5721 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5722 | { } |
| 5723 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5724 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5725 | |
| 5726 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5727 | /* Line out and output */ |
| 5728 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5729 | /* mono output */ |
| 5730 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5731 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5732 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5733 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5734 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5735 | /* Line In pin widget for input */ |
| 5736 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5737 | /* Headphone pin widget for output */ |
| 5738 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5739 | /* CD pin widget for input */ |
| 5740 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5741 | /* unmute amp left and right */ |
| 5742 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5743 | /* set connection select to line in (default select for this ADC) */ |
| 5744 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5745 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5746 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5747 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5748 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5749 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5750 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5751 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5752 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5753 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5754 | * Line In 2 = 0x03 |
| 5755 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5756 | /* mute analog inputs */ |
| 5757 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5758 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5759 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5760 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5761 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5762 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5763 | /* Unmute Front out path */ |
| 5764 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5765 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5766 | /* Unmute Headphone out path */ |
| 5767 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5768 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5769 | /* Unmute Mono out path */ |
| 5770 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5771 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5772 | { } |
| 5773 | }; |
| 5774 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5775 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5776 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5777 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5778 | */ |
| 5779 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5780 | /* Disable all GPIOs */ |
| 5781 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5782 | /* Internal speaker is connected to headphone pin */ |
| 5783 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5784 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5785 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5786 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5787 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5788 | /* Ensure all other unused pins are disabled and muted. */ |
| 5789 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5790 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5791 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5792 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5793 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5794 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5795 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5796 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5797 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5798 | /* Disable digital (SPDIF) pins */ |
| 5799 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5800 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5801 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5802 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5803 | * when acting as an output. |
| 5804 | */ |
| 5805 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5806 | |
| 5807 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5808 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5809 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5810 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5811 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5812 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5813 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5814 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5815 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5816 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5817 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5818 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5819 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5820 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5821 | * If the pin mode is changed by the user the pin mode control will |
| 5822 | * take care of enabling the pin's input/output buffers as needed. |
| 5823 | * Therefore there's no need to enable the input buffer at this |
| 5824 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5825 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5826 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5827 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5828 | * mixer ctrl) |
| 5829 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5830 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5831 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5832 | /* Mute capture amp left and right */ |
| 5833 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5834 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5835 | * in (on mic1 pin) |
| 5836 | */ |
| 5837 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5838 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5839 | /* Do the same for the second ADC: mute capture input amp and |
| 5840 | * set ADC connection to line in (on mic1 pin) |
| 5841 | */ |
| 5842 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5843 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5844 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5845 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5846 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5847 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5848 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5849 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5850 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5851 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5852 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5853 | {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] | 5854 | |
| 5855 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5856 | }; |
| 5857 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5858 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5859 | * similar laptops (adapted from Fujitsu init verbs). |
| 5860 | */ |
| 5861 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5862 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5863 | * the headphone jack. Turn this on and rely on the standard mute |
| 5864 | * methods whenever the user wants to turn these outputs off. |
| 5865 | */ |
| 5866 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5867 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5868 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5869 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5870 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5871 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5872 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5873 | /* Line In jack is connected to Line1 pin */ |
| 5874 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5875 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5876 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5877 | /* Ensure all other unused pins are disabled and muted. */ |
| 5878 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5879 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5880 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5881 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5882 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5883 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5884 | /* Disable digital (SPDIF) pins */ |
| 5885 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5886 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5887 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5888 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5889 | * bus when acting as outputs. |
| 5890 | */ |
| 5891 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5892 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5893 | |
| 5894 | /* Start with output sum widgets muted and their output gains at min */ |
| 5895 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5896 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5897 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5898 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5899 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5900 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5901 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5902 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5903 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5904 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5905 | /* Unmute Line-out pin widget amp left and right |
| 5906 | * (no equiv mixer ctrl) |
| 5907 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5908 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5909 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5910 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5911 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5912 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5913 | * will take care of enabling the pin's input/output buffers as needed. |
| 5914 | * Therefore there's no need to enable the input buffer at this |
| 5915 | * stage. |
| 5916 | */ |
| 5917 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5918 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5919 | |
| 5920 | /* Mute capture amp left and right */ |
| 5921 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5922 | /* Set ADC connection select to match default mixer setting - mic |
| 5923 | * (on mic1 pin) |
| 5924 | */ |
| 5925 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5926 | |
| 5927 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5928 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5929 | */ |
| 5930 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5931 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5932 | |
| 5933 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5934 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5935 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5936 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5937 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5938 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5939 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5940 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5941 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5942 | |
| 5943 | { } |
| 5944 | }; |
| 5945 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5946 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5947 | * (adapted from Acer init verbs). |
| 5948 | */ |
| 5949 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5950 | /* GPIO 0 enables the output jack. |
| 5951 | * Turn this on and rely on the standard mute |
| 5952 | * methods whenever the user wants to turn these outputs off. |
| 5953 | */ |
| 5954 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5955 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5956 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5957 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5958 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5959 | /* Ensure all other unused pins are disabled and muted. */ |
| 5960 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5961 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5962 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5963 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5964 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5965 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5966 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5967 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5968 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5969 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5970 | /* Disable digital (SPDIF) pins */ |
| 5971 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5972 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5973 | |
| 5974 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5975 | * bus when acting as outputs. |
| 5976 | */ |
| 5977 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5978 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5979 | |
| 5980 | /* Start with output sum widgets muted and their output gains at min */ |
| 5981 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5982 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5983 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5984 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5985 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5986 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5987 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5988 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5989 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5990 | |
| 5991 | /* Unmute Line-out pin widget amp left and right |
| 5992 | * (no equiv mixer ctrl) |
| 5993 | */ |
| 5994 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5995 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5996 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5997 | * will take care of enabling the pin's input/output buffers as needed. |
| 5998 | * Therefore there's no need to enable the input buffer at this |
| 5999 | * stage. |
| 6000 | */ |
| 6001 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6002 | |
| 6003 | /* Mute capture amp left and right */ |
| 6004 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6005 | /* Set ADC connection select to match default mixer setting - mic |
| 6006 | * (on mic1 pin) |
| 6007 | */ |
| 6008 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6009 | |
| 6010 | /* Do similar with the second ADC: mute capture input amp and |
| 6011 | * set ADC connection to mic to match ALSA's default state. |
| 6012 | */ |
| 6013 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6014 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6015 | |
| 6016 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6017 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6018 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6019 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6020 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6021 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6022 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6023 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6024 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6025 | |
| 6026 | { } |
| 6027 | }; |
| 6028 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6029 | static struct hda_verb alc260_will_verbs[] = { |
| 6030 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6031 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6032 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6033 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6034 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6035 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6036 | {} |
| 6037 | }; |
| 6038 | |
| 6039 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6040 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6041 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6042 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6043 | |
| 6044 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6045 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6046 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6047 | |
| 6048 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6049 | {} |
| 6050 | }; |
| 6051 | |
| 6052 | /* toggle speaker-output according to the hp-jack state */ |
| 6053 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6054 | { |
| 6055 | unsigned int present; |
| 6056 | |
| 6057 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6058 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6059 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6060 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6061 | AC_VERB_SET_GPIO_DATA, 1); |
| 6062 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6063 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6064 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6065 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6066 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6067 | AC_VERB_SET_GPIO_DATA, 0); |
| 6068 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6069 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6070 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6071 | } |
| 6072 | } |
| 6073 | |
| 6074 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6075 | unsigned int res) |
| 6076 | { |
| 6077 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6078 | alc260_replacer_672v_automute(codec); |
| 6079 | } |
| 6080 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6081 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6082 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6083 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6084 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6085 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6086 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6087 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6088 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6089 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6090 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6091 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6092 | {} |
| 6093 | }; |
| 6094 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6095 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6096 | * configuration. |
| 6097 | */ |
| 6098 | #ifdef CONFIG_SND_DEBUG |
| 6099 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6100 | 0x02, |
| 6101 | }; |
| 6102 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6103 | 0x04, 0x05, |
| 6104 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6105 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6106 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6107 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6108 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6109 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6110 | { |
| 6111 | .num_items = 7, |
| 6112 | .items = { |
| 6113 | { "MIC1 pin", 0x0 }, |
| 6114 | { "MIC2 pin", 0x1 }, |
| 6115 | { "LINE1 pin", 0x2 }, |
| 6116 | { "LINE2 pin", 0x3 }, |
| 6117 | { "CD pin", 0x4 }, |
| 6118 | { "LINE-OUT pin", 0x5 }, |
| 6119 | { "HP-OUT pin", 0x6 }, |
| 6120 | }, |
| 6121 | }, |
| 6122 | { |
| 6123 | .num_items = 8, |
| 6124 | .items = { |
| 6125 | { "MIC1 pin", 0x0 }, |
| 6126 | { "MIC2 pin", 0x1 }, |
| 6127 | { "LINE1 pin", 0x2 }, |
| 6128 | { "LINE2 pin", 0x3 }, |
| 6129 | { "CD pin", 0x4 }, |
| 6130 | { "Mixer", 0x5 }, |
| 6131 | { "LINE-OUT pin", 0x6 }, |
| 6132 | { "HP-OUT pin", 0x7 }, |
| 6133 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6134 | }, |
| 6135 | }; |
| 6136 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6137 | /* Output driver widgets */ |
| 6138 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6139 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6140 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6141 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6142 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6143 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6144 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6145 | /* Modes for retasking pin widgets |
| 6146 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6147 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6148 | * mention this restriction. At this stage it's not clear whether |
| 6149 | * this behaviour is intentional or is a hardware bug in chip |
| 6150 | * revisions available at least up until early 2006. Therefore for |
| 6151 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6152 | * choices, but if it turns out that the lack of mic bias for these |
| 6153 | * NIDs is intentional we could change their modes from |
| 6154 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6155 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6156 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6157 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6158 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6159 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6160 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6161 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6162 | |
| 6163 | /* Loopback mixer controls */ |
| 6164 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6165 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6166 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6167 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6168 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6169 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6170 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6171 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6172 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6173 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6174 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6175 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6176 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6177 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6178 | |
| 6179 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6180 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6181 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6182 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6183 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6184 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6185 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6186 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6187 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6188 | */ |
| 6189 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6190 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6191 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6192 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6193 | * this output to turn on an external amplifier. |
| 6194 | */ |
| 6195 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6196 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6197 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6198 | { } /* end */ |
| 6199 | }; |
| 6200 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6201 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6202 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6203 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6204 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6205 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6206 | /* Enable retasking pins as output, initially without power amp */ |
| 6207 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6208 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6209 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6210 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6211 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6212 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6213 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6214 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6215 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6216 | * payload also sets the generation to 0, output to be in "consumer" |
| 6217 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6218 | * control. |
| 6219 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6220 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6221 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6222 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6223 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6224 | * OUT1 sum bus when acting as an output. |
| 6225 | */ |
| 6226 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6227 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6228 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6229 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6230 | |
| 6231 | /* Start with output sum widgets muted and their output gains at min */ |
| 6232 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6233 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6234 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6235 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6236 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6237 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6238 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6239 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6240 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6241 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6242 | /* Unmute retasking pin widget output buffers since the default |
| 6243 | * state appears to be output. As the pin mode is changed by the |
| 6244 | * user the pin mode control will take care of enabling the pin's |
| 6245 | * input/output buffers as needed. |
| 6246 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6247 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6248 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6249 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6250 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6251 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6252 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6253 | /* Also unmute the mono-out pin widget */ |
| 6254 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6255 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6256 | /* Mute capture amp left and right */ |
| 6257 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6258 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6259 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6260 | */ |
| 6261 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6262 | |
| 6263 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6264 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6265 | */ |
| 6266 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6267 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6268 | |
| 6269 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6270 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6271 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6272 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6273 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6274 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6275 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6276 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6277 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6278 | |
| 6279 | { } |
| 6280 | }; |
| 6281 | #endif |
| 6282 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6283 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6284 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6285 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6286 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6287 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6288 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6289 | /* |
| 6290 | * for BIOS auto-configuration |
| 6291 | */ |
| 6292 | |
| 6293 | 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] | 6294 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6295 | { |
| 6296 | hda_nid_t nid_vol; |
| 6297 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6298 | int err; |
| 6299 | |
| 6300 | if (nid >= 0x0f && nid < 0x11) { |
| 6301 | nid_vol = nid - 0x7; |
| 6302 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6303 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6304 | } else if (nid == 0x11) { |
| 6305 | nid_vol = nid - 0x7; |
| 6306 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6307 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6308 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6309 | nid_vol = 0x08; |
| 6310 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6311 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6312 | } else |
| 6313 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6314 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6315 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6316 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6317 | 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] | 6318 | if (err < 0) |
| 6319 | return err; |
| 6320 | *vol_bits |= (1 << nid_vol); |
| 6321 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6322 | 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] | 6323 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6324 | return err; |
| 6325 | return 1; |
| 6326 | } |
| 6327 | |
| 6328 | /* add playback controls from the parsed DAC table */ |
| 6329 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6330 | const struct auto_pin_cfg *cfg) |
| 6331 | { |
| 6332 | hda_nid_t nid; |
| 6333 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6334 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6335 | |
| 6336 | spec->multiout.num_dacs = 1; |
| 6337 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6338 | spec->multiout.dac_nids[0] = 0x02; |
| 6339 | |
| 6340 | nid = cfg->line_out_pins[0]; |
| 6341 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6342 | const char *pfx; |
| 6343 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6344 | pfx = "Master"; |
| 6345 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6346 | pfx = "Speaker"; |
| 6347 | else |
| 6348 | pfx = "Front"; |
| 6349 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6350 | if (err < 0) |
| 6351 | return err; |
| 6352 | } |
| 6353 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6354 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6355 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6356 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6357 | if (err < 0) |
| 6358 | return err; |
| 6359 | } |
| 6360 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6361 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6362 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6363 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6364 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6365 | if (err < 0) |
| 6366 | return err; |
| 6367 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6368 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6369 | } |
| 6370 | |
| 6371 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6372 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6373 | const struct auto_pin_cfg *cfg) |
| 6374 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6375 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6376 | } |
| 6377 | |
| 6378 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6379 | hda_nid_t nid, int pin_type, |
| 6380 | int sel_idx) |
| 6381 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6382 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6383 | /* need the manual connection? */ |
| 6384 | if (nid >= 0x12) { |
| 6385 | int idx = nid - 0x12; |
| 6386 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6387 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6388 | } |
| 6389 | } |
| 6390 | |
| 6391 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6392 | { |
| 6393 | struct alc_spec *spec = codec->spec; |
| 6394 | hda_nid_t nid; |
| 6395 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6396 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6397 | if (nid) { |
| 6398 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6399 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6400 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6401 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6402 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6403 | if (nid) |
| 6404 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6405 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6406 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6407 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6408 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6409 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6410 | |
| 6411 | #define ALC260_PIN_CD_NID 0x16 |
| 6412 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6413 | { |
| 6414 | struct alc_spec *spec = codec->spec; |
| 6415 | int i; |
| 6416 | |
| 6417 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6418 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6419 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6420 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6421 | if (nid != ALC260_PIN_CD_NID && |
| 6422 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6423 | snd_hda_codec_write(codec, nid, 0, |
| 6424 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6425 | AMP_OUT_MUTE); |
| 6426 | } |
| 6427 | } |
| 6428 | } |
| 6429 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6430 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 6431 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6432 | /* |
| 6433 | * generic initialization of ADC, input mixers and output mixers |
| 6434 | */ |
| 6435 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6436 | /* |
| 6437 | * Unmute ADC0-1 and set the default input to mic-in |
| 6438 | */ |
| 6439 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6440 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6441 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6442 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6443 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6444 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6445 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6446 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6447 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6448 | */ |
| 6449 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6450 | /* mute analog inputs */ |
| 6451 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6452 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6453 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6454 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6455 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6456 | |
| 6457 | /* |
| 6458 | * Set up output mixers (0x08 - 0x0a) |
| 6459 | */ |
| 6460 | /* set vol=0 to output mixers */ |
| 6461 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6462 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6463 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6464 | /* set up input amps for analog loopback */ |
| 6465 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6466 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6467 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6468 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6469 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6470 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6471 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6472 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6473 | { } |
| 6474 | }; |
| 6475 | |
| 6476 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6477 | { |
| 6478 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6479 | int err; |
| 6480 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6481 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6482 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6483 | alc260_ignore); |
| 6484 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6485 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6486 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6487 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6488 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6489 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6490 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6491 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6492 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6493 | return err; |
| 6494 | |
| 6495 | spec->multiout.max_channels = 2; |
| 6496 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6497 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6498 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6499 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6500 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6501 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6502 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6503 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6504 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6505 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6506 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 6507 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6508 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6509 | return 1; |
| 6510 | } |
| 6511 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6512 | /* additional initialization for auto-configuration model */ |
| 6513 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6514 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6515 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6516 | alc260_auto_init_multi_out(codec); |
| 6517 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6518 | alc260_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6519 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6520 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6521 | } |
| 6522 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6523 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6524 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6525 | { 0x07, HDA_INPUT, 0 }, |
| 6526 | { 0x07, HDA_INPUT, 1 }, |
| 6527 | { 0x07, HDA_INPUT, 2 }, |
| 6528 | { 0x07, HDA_INPUT, 3 }, |
| 6529 | { 0x07, HDA_INPUT, 4 }, |
| 6530 | { } /* end */ |
| 6531 | }; |
| 6532 | #endif |
| 6533 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6534 | /* |
| 6535 | * ALC260 configurations |
| 6536 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6537 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6538 | [ALC260_BASIC] = "basic", |
| 6539 | [ALC260_HP] = "hp", |
| 6540 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6541 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6542 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6543 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6544 | [ALC260_WILL] = "will", |
| 6545 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6546 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6547 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6548 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6549 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6550 | [ALC260_AUTO] = "auto", |
| 6551 | }; |
| 6552 | |
| 6553 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6554 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 6555 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6556 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6557 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6558 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 6559 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6560 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6561 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6562 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6563 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6564 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6565 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6566 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6567 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6568 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6569 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6570 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6571 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6572 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6573 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6574 | {} |
| 6575 | }; |
| 6576 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6577 | static struct alc_config_preset alc260_presets[] = { |
| 6578 | [ALC260_BASIC] = { |
| 6579 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6580 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6581 | .init_verbs = { alc260_init_verbs }, |
| 6582 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6583 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6584 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 6585 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6586 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6587 | .channel_mode = alc260_modes, |
| 6588 | .input_mux = &alc260_capture_source, |
| 6589 | }, |
| 6590 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6591 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6592 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6593 | .init_verbs = { alc260_init_verbs, |
| 6594 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6595 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6596 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6597 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6598 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6599 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6600 | .channel_mode = alc260_modes, |
| 6601 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6602 | .unsol_event = alc260_hp_unsol_event, |
| 6603 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6604 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6605 | [ALC260_HP_DC7600] = { |
| 6606 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6607 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6608 | .init_verbs = { alc260_init_verbs, |
| 6609 | alc260_hp_dc7600_verbs }, |
| 6610 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6611 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6612 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6613 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6614 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6615 | .channel_mode = alc260_modes, |
| 6616 | .input_mux = &alc260_capture_source, |
| 6617 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6618 | .init_hook = alc260_hp_3012_automute, |
| 6619 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6620 | [ALC260_HP_3013] = { |
| 6621 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6622 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6623 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6624 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6625 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6626 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6627 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6628 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6629 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6630 | .channel_mode = alc260_modes, |
| 6631 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6632 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6633 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6634 | }, |
| 6635 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6636 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6637 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6638 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6639 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6640 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6641 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6642 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6643 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6644 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6645 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6646 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6647 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6648 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6649 | .init_verbs = { alc260_acer_init_verbs }, |
| 6650 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6651 | .dac_nids = alc260_dac_nids, |
| 6652 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6653 | .adc_nids = alc260_dual_adc_nids, |
| 6654 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6655 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6656 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6657 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6658 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6659 | [ALC260_FAVORIT100] = { |
| 6660 | .mixers = { alc260_favorit100_mixer }, |
| 6661 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6662 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6663 | .dac_nids = alc260_dac_nids, |
| 6664 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6665 | .adc_nids = alc260_dual_adc_nids, |
| 6666 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6667 | .channel_mode = alc260_modes, |
| 6668 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6669 | .input_mux = alc260_favorit100_capture_sources, |
| 6670 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6671 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6672 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6673 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6674 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6675 | .dac_nids = alc260_dac_nids, |
| 6676 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6677 | .adc_nids = alc260_adc_nids, |
| 6678 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6679 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6680 | .channel_mode = alc260_modes, |
| 6681 | .input_mux = &alc260_capture_source, |
| 6682 | }, |
| 6683 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6684 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6685 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6686 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6687 | .dac_nids = alc260_dac_nids, |
| 6688 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6689 | .adc_nids = alc260_adc_nids, |
| 6690 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6691 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6692 | .channel_mode = alc260_modes, |
| 6693 | .input_mux = &alc260_capture_source, |
| 6694 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6695 | .init_hook = alc260_replacer_672v_automute, |
| 6696 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6697 | #ifdef CONFIG_SND_DEBUG |
| 6698 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6699 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6700 | .init_verbs = { alc260_test_init_verbs }, |
| 6701 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6702 | .dac_nids = alc260_test_dac_nids, |
| 6703 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6704 | .adc_nids = alc260_test_adc_nids, |
| 6705 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6706 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6707 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6708 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6709 | }, |
| 6710 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6711 | }; |
| 6712 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6713 | static int patch_alc260(struct hda_codec *codec) |
| 6714 | { |
| 6715 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6716 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6717 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6718 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6719 | if (spec == NULL) |
| 6720 | return -ENOMEM; |
| 6721 | |
| 6722 | codec->spec = spec; |
| 6723 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6724 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6725 | alc260_models, |
| 6726 | alc260_cfg_tbl); |
| 6727 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6728 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6729 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6730 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6731 | } |
| 6732 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6733 | if (board_config == ALC260_AUTO) { |
| 6734 | /* automatic parse from the BIOS config */ |
| 6735 | err = alc260_parse_auto_config(codec); |
| 6736 | if (err < 0) { |
| 6737 | alc_free(codec); |
| 6738 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6739 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6740 | printk(KERN_INFO |
| 6741 | "hda_codec: Cannot set up configuration " |
| 6742 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6743 | board_config = ALC260_BASIC; |
| 6744 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6745 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6746 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6747 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6748 | if (err < 0) { |
| 6749 | alc_free(codec); |
| 6750 | return err; |
| 6751 | } |
| 6752 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6753 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 6754 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6755 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6756 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6757 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6758 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6759 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6760 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6761 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6762 | if (!spec->adc_nids && spec->input_mux) { |
| 6763 | /* check whether NID 0x04 is valid */ |
| 6764 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6765 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6766 | /* get type */ |
| 6767 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6768 | spec->adc_nids = alc260_adc_nids_alt; |
| 6769 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6770 | } else { |
| 6771 | spec->adc_nids = alc260_adc_nids; |
| 6772 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6773 | } |
| 6774 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 6775 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6776 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6777 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6778 | spec->vmaster_nid = 0x08; |
| 6779 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6780 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6781 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6782 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6783 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6784 | if (!spec->loopback.amplist) |
| 6785 | spec->loopback.amplist = alc260_loopbacks; |
| 6786 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6787 | |
| 6788 | return 0; |
| 6789 | } |
| 6790 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6791 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6792 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6793 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6794 | * |
| 6795 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6796 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6797 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6798 | * 6-channel independent captures. |
| 6799 | * |
| 6800 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6801 | * driver yet). |
| 6802 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6803 | #define ALC882_DIGOUT_NID 0x06 |
| 6804 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6805 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6806 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6807 | #define ALC1200_DIGOUT_NID 0x10 |
| 6808 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6809 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6810 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6811 | { 8, NULL } |
| 6812 | }; |
| 6813 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6814 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6815 | static hda_nid_t alc882_dac_nids[4] = { |
| 6816 | /* front, rear, clfe, rear_surr */ |
| 6817 | 0x02, 0x03, 0x04, 0x05 |
| 6818 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6819 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6820 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6821 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6822 | #define alc882_adc_nids alc880_adc_nids |
| 6823 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6824 | #define alc883_adc_nids alc882_adc_nids_alt |
| 6825 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 6826 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 6827 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6828 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6829 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6830 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6831 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 6832 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 6833 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6834 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6835 | /* input MUX */ |
| 6836 | /* FIXME: should be a matrix-type input source selection */ |
| 6837 | |
| 6838 | static struct hda_input_mux alc882_capture_source = { |
| 6839 | .num_items = 4, |
| 6840 | .items = { |
| 6841 | { "Mic", 0x0 }, |
| 6842 | { "Front Mic", 0x1 }, |
| 6843 | { "Line", 0x2 }, |
| 6844 | { "CD", 0x4 }, |
| 6845 | }, |
| 6846 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6847 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6848 | #define alc883_capture_source alc882_capture_source |
| 6849 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6850 | static struct hda_input_mux alc889_capture_source = { |
| 6851 | .num_items = 3, |
| 6852 | .items = { |
| 6853 | { "Front Mic", 0x0 }, |
| 6854 | { "Mic", 0x3 }, |
| 6855 | { "Line", 0x2 }, |
| 6856 | }, |
| 6857 | }; |
| 6858 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6859 | static struct hda_input_mux mb5_capture_source = { |
| 6860 | .num_items = 3, |
| 6861 | .items = { |
| 6862 | { "Mic", 0x1 }, |
| 6863 | { "Line", 0x2 }, |
| 6864 | { "CD", 0x4 }, |
| 6865 | }, |
| 6866 | }; |
| 6867 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 6868 | static struct hda_input_mux macmini3_capture_source = { |
| 6869 | .num_items = 2, |
| 6870 | .items = { |
| 6871 | { "Line", 0x2 }, |
| 6872 | { "CD", 0x4 }, |
| 6873 | }, |
| 6874 | }; |
| 6875 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6876 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6877 | .num_items = 4, |
| 6878 | .items = { |
| 6879 | { "Mic", 0x1 }, |
| 6880 | { "Front Mic", 0x0 }, |
| 6881 | { "Line", 0x2 }, |
| 6882 | { "CD", 0x4 }, |
| 6883 | }, |
| 6884 | }; |
| 6885 | |
| 6886 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6887 | .num_items = 2, |
| 6888 | .items = { |
| 6889 | { "Mic", 0x1 }, |
| 6890 | { "Line", 0x2 }, |
| 6891 | }, |
| 6892 | }; |
| 6893 | |
| 6894 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6895 | .num_items = 4, |
| 6896 | .items = { |
| 6897 | { "Mic", 0x0 }, |
| 6898 | { "iMic", 0x1 }, |
| 6899 | { "Line", 0x2 }, |
| 6900 | { "CD", 0x4 }, |
| 6901 | }, |
| 6902 | }; |
| 6903 | |
| 6904 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6905 | .num_items = 2, |
| 6906 | .items = { |
| 6907 | { "Mic", 0x0 }, |
| 6908 | { "Int Mic", 0x1 }, |
| 6909 | }, |
| 6910 | }; |
| 6911 | |
| 6912 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6913 | .num_items = 3, |
| 6914 | .items = { |
| 6915 | { "Mic", 0x0 }, |
| 6916 | { "Front Mic", 0x1 }, |
| 6917 | { "Line", 0x4 }, |
| 6918 | }, |
| 6919 | }; |
| 6920 | |
| 6921 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6922 | .num_items = 2, |
| 6923 | .items = { |
| 6924 | { "Mic", 0x0 }, |
| 6925 | { "Line", 0x2 }, |
| 6926 | }, |
| 6927 | }; |
| 6928 | |
| 6929 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 6930 | .num_items = 2, |
| 6931 | .items = { |
| 6932 | { "Mic", 0x0 }, |
| 6933 | /* Front Mic (0x01) unused */ |
| 6934 | { "Line", 0x2 }, |
| 6935 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 6936 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6937 | }, |
| 6938 | }; |
| 6939 | |
| 6940 | /* |
| 6941 | * 2ch mode |
| 6942 | */ |
| 6943 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6944 | { 2, NULL } |
| 6945 | }; |
| 6946 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6947 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6948 | * 2ch mode |
| 6949 | */ |
| 6950 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6951 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6952 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6953 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6954 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6955 | { } /* end */ |
| 6956 | }; |
| 6957 | |
| 6958 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6959 | * 4ch mode |
| 6960 | */ |
| 6961 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 6962 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6963 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6964 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6965 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6966 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6967 | { } /* end */ |
| 6968 | }; |
| 6969 | |
| 6970 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6971 | * 6ch mode |
| 6972 | */ |
| 6973 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6974 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6975 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6976 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6977 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6978 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6979 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6980 | { } /* end */ |
| 6981 | }; |
| 6982 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6983 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6984 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6985 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6986 | { 6, alc882_3ST_ch6_init }, |
| 6987 | }; |
| 6988 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6989 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 6990 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6991 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 6992 | * 2ch mode |
| 6993 | */ |
| 6994 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 6995 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 6996 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6997 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6998 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6999 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7000 | { } /* end */ |
| 7001 | }; |
| 7002 | |
| 7003 | /* |
| 7004 | * 4ch mode |
| 7005 | */ |
| 7006 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7007 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7008 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7009 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7010 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7011 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7012 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7013 | { } /* end */ |
| 7014 | }; |
| 7015 | |
| 7016 | /* |
| 7017 | * 6ch mode |
| 7018 | */ |
| 7019 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7020 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7021 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7022 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7023 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7024 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7025 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7026 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7027 | { } /* end */ |
| 7028 | }; |
| 7029 | |
| 7030 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7031 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7032 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7033 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7034 | }; |
| 7035 | |
| 7036 | |
| 7037 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7038 | * 6ch mode |
| 7039 | */ |
| 7040 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7041 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7042 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7043 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7044 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7045 | { } /* end */ |
| 7046 | }; |
| 7047 | |
| 7048 | /* |
| 7049 | * 8ch mode |
| 7050 | */ |
| 7051 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7052 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7053 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7054 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7055 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7056 | { } /* end */ |
| 7057 | }; |
| 7058 | |
| 7059 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7060 | { 6, alc882_sixstack_ch6_init }, |
| 7061 | { 8, alc882_sixstack_ch8_init }, |
| 7062 | }; |
| 7063 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7064 | |
| 7065 | /* Macbook Air 2,1 */ |
| 7066 | |
| 7067 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7068 | { 2, NULL }, |
| 7069 | }; |
| 7070 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7071 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7072 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7073 | */ |
| 7074 | |
| 7075 | /* |
| 7076 | * 2ch mode |
| 7077 | */ |
| 7078 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7079 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7080 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7081 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7082 | { } /* end */ |
| 7083 | }; |
| 7084 | |
| 7085 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7086 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7087 | */ |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7088 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7089 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7090 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7091 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7092 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7093 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7094 | { } /* end */ |
| 7095 | }; |
| 7096 | |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7097 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7098 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7099 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7100 | }; |
| 7101 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7102 | /* |
| 7103 | * 2ch |
| 7104 | * Speakers/Woofer/HP = Front |
| 7105 | * LineIn = Input |
| 7106 | */ |
| 7107 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7108 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7109 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7110 | { } /* end */ |
| 7111 | }; |
| 7112 | |
| 7113 | /* |
| 7114 | * 6ch mode |
| 7115 | * Speakers/HP = Front |
| 7116 | * Woofer = LFE |
| 7117 | * LineIn = Surround |
| 7118 | */ |
| 7119 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7120 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7121 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7122 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7123 | { } /* end */ |
| 7124 | }; |
| 7125 | |
| 7126 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7127 | { 2, alc885_mb5_ch2_init }, |
| 7128 | { 6, alc885_mb5_ch6_init }, |
| 7129 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7130 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7131 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7132 | |
| 7133 | /* |
| 7134 | * 2ch mode |
| 7135 | */ |
| 7136 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7137 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7138 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7139 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7140 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7141 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7142 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7143 | { } /* end */ |
| 7144 | }; |
| 7145 | |
| 7146 | /* |
| 7147 | * 4ch mode |
| 7148 | */ |
| 7149 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7150 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7151 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7152 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7153 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7154 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7155 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7156 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7157 | { } /* end */ |
| 7158 | }; |
| 7159 | |
| 7160 | /* |
| 7161 | * 6ch mode |
| 7162 | */ |
| 7163 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7164 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7165 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7166 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7167 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7168 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7169 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7170 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7171 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7172 | { } /* end */ |
| 7173 | }; |
| 7174 | |
| 7175 | /* |
| 7176 | * 8ch mode |
| 7177 | */ |
| 7178 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7179 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7180 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7181 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7182 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7183 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7184 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7185 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7186 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7187 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7188 | { } /* end */ |
| 7189 | }; |
| 7190 | |
| 7191 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7192 | { 2, alc883_4ST_ch2_init }, |
| 7193 | { 4, alc883_4ST_ch4_init }, |
| 7194 | { 6, alc883_4ST_ch6_init }, |
| 7195 | { 8, alc883_4ST_ch8_init }, |
| 7196 | }; |
| 7197 | |
| 7198 | |
| 7199 | /* |
| 7200 | * 2ch mode |
| 7201 | */ |
| 7202 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7203 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7204 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7205 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7206 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7207 | { } /* end */ |
| 7208 | }; |
| 7209 | |
| 7210 | /* |
| 7211 | * 4ch mode |
| 7212 | */ |
| 7213 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7214 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7215 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7216 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7217 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7218 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7219 | { } /* end */ |
| 7220 | }; |
| 7221 | |
| 7222 | /* |
| 7223 | * 6ch mode |
| 7224 | */ |
| 7225 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7226 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7227 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7228 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7229 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7230 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7231 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7232 | { } /* end */ |
| 7233 | }; |
| 7234 | |
| 7235 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7236 | { 2, alc883_3ST_ch2_intel_init }, |
| 7237 | { 4, alc883_3ST_ch4_intel_init }, |
| 7238 | { 6, alc883_3ST_ch6_intel_init }, |
| 7239 | }; |
| 7240 | |
| 7241 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7242 | * 2ch mode |
| 7243 | */ |
| 7244 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7245 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7246 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7247 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7248 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7249 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7250 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7251 | { } /* end */ |
| 7252 | }; |
| 7253 | |
| 7254 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7255 | * 6ch mode |
| 7256 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7257 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7258 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7259 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7260 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7261 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7262 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7263 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7264 | { } /* end */ |
| 7265 | }; |
| 7266 | |
| 7267 | /* |
| 7268 | * 8ch mode |
| 7269 | */ |
| 7270 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7271 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7272 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7273 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7274 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7275 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7276 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7277 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7278 | { } /* end */ |
| 7279 | }; |
| 7280 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7281 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7282 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7283 | { 6, alc889_ch6_intel_init }, |
| 7284 | { 8, alc889_ch8_intel_init }, |
| 7285 | }; |
| 7286 | |
| 7287 | /* |
| 7288 | * 6ch mode |
| 7289 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7290 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7291 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7292 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7293 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7294 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7295 | { } /* end */ |
| 7296 | }; |
| 7297 | |
| 7298 | /* |
| 7299 | * 8ch mode |
| 7300 | */ |
| 7301 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7302 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7303 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7304 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7305 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7306 | { } /* end */ |
| 7307 | }; |
| 7308 | |
| 7309 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7310 | { 6, alc883_sixstack_ch6_init }, |
| 7311 | { 8, alc883_sixstack_ch8_init }, |
| 7312 | }; |
| 7313 | |
| 7314 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7315 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7316 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7317 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7318 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7319 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7320 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7321 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7322 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7323 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7324 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7325 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7326 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7327 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7328 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7329 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7330 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7331 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7332 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7333 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7334 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7335 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7336 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7337 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7338 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7339 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7340 | { } /* end */ |
| 7341 | }; |
| 7342 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7343 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 7344 | |
| 7345 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 7346 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7347 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 7348 | { } |
| 7349 | }; |
| 7350 | |
| 7351 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7352 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7353 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7354 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7355 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7356 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7357 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7358 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7359 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7360 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7361 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7362 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7363 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7364 | { } /* end */ |
| 7365 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7366 | |
| 7367 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7368 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7369 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7370 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7371 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7372 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7373 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7374 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7375 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7376 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7377 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7378 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7379 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7380 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7381 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7382 | { } /* end */ |
| 7383 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7384 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7385 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 7386 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7387 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7388 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7389 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7390 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7391 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7392 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7393 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 7394 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7395 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 7396 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7397 | { } /* end */ |
| 7398 | }; |
| 7399 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7400 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
| 7401 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7402 | HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7403 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 7404 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7405 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7406 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7407 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7408 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 7409 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7410 | { } /* end */ |
| 7411 | }; |
| 7412 | |
| 7413 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7414 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7415 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7416 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7417 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7418 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7419 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7420 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7421 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7422 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7423 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7424 | { } /* end */ |
| 7425 | }; |
| 7426 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7427 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7428 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7429 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7430 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7431 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7432 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7433 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7434 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7435 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7436 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7437 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7438 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7439 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7440 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7441 | { } /* end */ |
| 7442 | }; |
| 7443 | |
| 7444 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7445 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7446 | */ |
| 7447 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7448 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7449 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7450 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7451 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7452 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7453 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7454 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7455 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7456 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7457 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7458 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7459 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7460 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7461 | { } /* end */ |
| 7462 | }; |
| 7463 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7464 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7465 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7466 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7467 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7468 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7469 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7470 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7471 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7472 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7473 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7474 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7475 | { } /* end */ |
| 7476 | }; |
| 7477 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7478 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7479 | { |
| 7480 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7481 | .name = "Channel Mode", |
| 7482 | .info = alc_ch_mode_info, |
| 7483 | .get = alc_ch_mode_get, |
| 7484 | .put = alc_ch_mode_put, |
| 7485 | }, |
| 7486 | { } /* end */ |
| 7487 | }; |
| 7488 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7489 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7490 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7491 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7492 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7493 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7494 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7495 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7496 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7497 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7498 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7499 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7500 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7501 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7502 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7503 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7504 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7505 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7506 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7507 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7508 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7509 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7510 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7511 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7512 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7513 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7514 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7515 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7516 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7517 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7518 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7519 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7520 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7521 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7522 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7523 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7524 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7525 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7526 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7527 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7528 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7529 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7530 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7531 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7532 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7533 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7534 | |
| 7535 | /* FIXME: use matrix-type input source selection */ |
| 7536 | /* 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] | 7537 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7538 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7539 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7540 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7541 | /* ADC2: mute amp left and right */ |
| 7542 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7543 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7544 | /* ADC3: mute amp left and right */ |
| 7545 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7546 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7547 | |
| 7548 | { } |
| 7549 | }; |
| 7550 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7551 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7552 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7553 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7554 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7555 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7556 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7557 | /* ADC1: mute amp left and right */ |
| 7558 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7559 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7560 | { } |
| 7561 | }; |
| 7562 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7563 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7564 | /* change to EAPD mode */ |
| 7565 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7566 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7567 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7568 | }; |
| 7569 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7570 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7571 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7572 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7573 | { } |
| 7574 | }; |
| 7575 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7576 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7577 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7578 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7579 | {} |
| 7580 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7581 | |
| 7582 | static struct hda_verb alc885_init_verbs[] = { |
| 7583 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7584 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7585 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7586 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7587 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7588 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7589 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7590 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7591 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7592 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7593 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7594 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7595 | |
| 7596 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7597 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7598 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7599 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7600 | /* Front Pin: output 0 (0x0c) */ |
| 7601 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7602 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7603 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7604 | /* Rear Pin: output 1 (0x0d) */ |
| 7605 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7606 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7607 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7608 | /* CLFE Pin: output 2 (0x0e) */ |
| 7609 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7610 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7611 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7612 | /* Side Pin: output 3 (0x0f) */ |
| 7613 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7614 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7615 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7616 | /* Mic (rear) pin: input vref at 80% */ |
| 7617 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7618 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7619 | /* Front Mic pin: input vref at 80% */ |
| 7620 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7621 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7622 | /* Line In pin: input */ |
| 7623 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7624 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7625 | |
| 7626 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7627 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7628 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7629 | /* Input mixer2 */ |
| 7630 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7631 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7632 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7633 | /* ADC2: mute amp left and right */ |
| 7634 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7635 | /* ADC3: mute amp left and right */ |
| 7636 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7637 | |
| 7638 | { } |
| 7639 | }; |
| 7640 | |
| 7641 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7642 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7643 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7644 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7645 | { } |
| 7646 | }; |
| 7647 | |
| 7648 | |
| 7649 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7650 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7651 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7652 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7653 | { } |
| 7654 | }; |
| 7655 | |
| 7656 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7657 | #define alc883_init_verbs alc882_base_init_verbs |
| 7658 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7659 | /* Mac Pro test */ |
| 7660 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7661 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7662 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7663 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7664 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7665 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7666 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 7667 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7668 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7669 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7670 | { } /* end */ |
| 7671 | }; |
| 7672 | |
| 7673 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7674 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7675 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7676 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7677 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7678 | /* Front Pin: output 0 (0x0c) */ |
| 7679 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7680 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7681 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7682 | /* Front Mic pin: input vref at 80% */ |
| 7683 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7684 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7685 | /* Speaker: output */ |
| 7686 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7687 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7688 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7689 | /* Headphone output (output 0 - 0x0c) */ |
| 7690 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7691 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7692 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7693 | |
| 7694 | /* FIXME: use matrix-type input source selection */ |
| 7695 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7696 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7697 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7698 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7699 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7700 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7701 | /* Input mixer2 */ |
| 7702 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7703 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7704 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7705 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7706 | /* Input mixer3 */ |
| 7707 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7708 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7709 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7710 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7711 | /* ADC1: mute amp left and right */ |
| 7712 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7713 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7714 | /* ADC2: mute amp left and right */ |
| 7715 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7716 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7717 | /* ADC3: mute amp left and right */ |
| 7718 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7719 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7720 | |
| 7721 | { } |
| 7722 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7723 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7724 | /* Macbook 5,1 */ |
| 7725 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7726 | /* DACs */ |
| 7727 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7728 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7729 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7730 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7731 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7732 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7733 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7734 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7735 | /* Surround mixer */ |
| 7736 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7737 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7738 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7739 | /* LFE mixer */ |
| 7740 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7741 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7742 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7743 | /* HP mixer */ |
| 7744 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7745 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7746 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7747 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7748 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7749 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7750 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7751 | /* LFE Pin (0x0e) */ |
| 7752 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7753 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7754 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7755 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7756 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7757 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7758 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7759 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7760 | /* Front Mic pin: input vref at 80% */ |
| 7761 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7762 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7763 | /* Line In pin */ |
| 7764 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7765 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7766 | |
| 7767 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7768 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7769 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7770 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7771 | { } |
| 7772 | }; |
| 7773 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7774 | /* Macmini 3,1 */ |
| 7775 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 7776 | /* DACs */ |
| 7777 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7778 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7779 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7780 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7781 | /* Front mixer */ |
| 7782 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7783 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7784 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7785 | /* Surround mixer */ |
| 7786 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7787 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7788 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7789 | /* LFE mixer */ |
| 7790 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7791 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7792 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7793 | /* HP mixer */ |
| 7794 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7795 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7796 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7797 | /* Front Pin (0x0c) */ |
| 7798 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7799 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7800 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7801 | /* LFE Pin (0x0e) */ |
| 7802 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7803 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7804 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7805 | /* HP Pin (0x0f) */ |
| 7806 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7807 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7808 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7809 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7810 | /* Line In pin */ |
| 7811 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7812 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7813 | |
| 7814 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7815 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7816 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7817 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7818 | { } |
| 7819 | }; |
| 7820 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7821 | |
| 7822 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 7823 | /*Internal and HP Speaker Mixer*/ |
| 7824 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7825 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7826 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7827 | /*Internal Speaker Pin (0x0c)*/ |
| 7828 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 7829 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7830 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7831 | /* HP Pin: output 0 (0x0e) */ |
| 7832 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 7833 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7834 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7835 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 7836 | /* Line in (is hp when jack connected)*/ |
| 7837 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 7838 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7839 | |
| 7840 | { } |
| 7841 | }; |
| 7842 | |
| 7843 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7844 | /* Macbook Pro rev3 */ |
| 7845 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 7846 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7847 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7848 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7849 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7850 | /* Rear mixer */ |
| 7851 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7852 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7853 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7854 | /* HP mixer */ |
| 7855 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7856 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7857 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7858 | /* Front Pin: output 0 (0x0c) */ |
| 7859 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7860 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7861 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7862 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7863 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7864 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7865 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7866 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7867 | /* Mic (rear) pin: input vref at 80% */ |
| 7868 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7869 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7870 | /* Front Mic pin: input vref at 80% */ |
| 7871 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7872 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7873 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7874 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7875 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7876 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7877 | |
| 7878 | /* FIXME: use matrix-type input source selection */ |
| 7879 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7880 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7881 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7882 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7883 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7884 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7885 | /* Input mixer2 */ |
| 7886 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7887 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7888 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7889 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7890 | /* Input mixer3 */ |
| 7891 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7892 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7893 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7894 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7895 | /* ADC1: mute amp left and right */ |
| 7896 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7897 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7898 | /* ADC2: mute amp left and right */ |
| 7899 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7900 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7901 | /* ADC3: mute amp left and right */ |
| 7902 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7903 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7904 | |
| 7905 | { } |
| 7906 | }; |
| 7907 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7908 | /* iMac 9,1 */ |
| 7909 | static struct hda_verb alc885_imac91_init_verbs[] = { |
| 7910 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 7911 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7912 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7913 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7914 | /* Rear mixer */ |
| 7915 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7916 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7917 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7918 | /* HP Pin: output 0 (0x0c) */ |
| 7919 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7920 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7921 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7922 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7923 | /* Internal Speakers: output 0 (0x0d) */ |
| 7924 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7925 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7926 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7927 | /* Mic (rear) pin: input vref at 80% */ |
| 7928 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7929 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7930 | /* Front Mic pin: input vref at 80% */ |
| 7931 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7932 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7933 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7934 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7935 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7936 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7937 | |
| 7938 | /* FIXME: use matrix-type input source selection */ |
| 7939 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7940 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7941 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7942 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7943 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7944 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7945 | /* Input mixer2 */ |
| 7946 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7947 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7948 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7949 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7950 | /* Input mixer3 */ |
| 7951 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7952 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7953 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7954 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7955 | /* ADC1: mute amp left and right */ |
| 7956 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7957 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7958 | /* ADC2: mute amp left and right */ |
| 7959 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7960 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7961 | /* ADC3: mute amp left and right */ |
| 7962 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7963 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7964 | |
| 7965 | { } |
| 7966 | }; |
| 7967 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7968 | /* iMac 24 mixer. */ |
| 7969 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 7970 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7971 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 7972 | { } /* end */ |
| 7973 | }; |
| 7974 | |
| 7975 | /* iMac 24 init verbs. */ |
| 7976 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 7977 | /* Internal speakers: output 0 (0x0c) */ |
| 7978 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7979 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7980 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7981 | /* Internal speakers: output 0 (0x0c) */ |
| 7982 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7983 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7984 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7985 | /* Headphone: output 0 (0x0c) */ |
| 7986 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7987 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7988 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7989 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7990 | /* Front Mic: input vref at 80% */ |
| 7991 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7992 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7993 | { } |
| 7994 | }; |
| 7995 | |
| 7996 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7997 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7998 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7999 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8000 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8001 | spec->autocfg.hp_pins[0] = 0x14; |
| 8002 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8003 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8004 | } |
| 8005 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8006 | #define alc885_mb5_setup alc885_imac24_setup |
| 8007 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8008 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8009 | /* Macbook Air 2,1 */ |
| 8010 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8011 | { |
| 8012 | struct alc_spec *spec = codec->spec; |
| 8013 | |
| 8014 | spec->autocfg.hp_pins[0] = 0x14; |
| 8015 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8016 | } |
| 8017 | |
| 8018 | |
| 8019 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8020 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8021 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8022 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8023 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8024 | spec->autocfg.hp_pins[0] = 0x15; |
| 8025 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8026 | } |
| 8027 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8028 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8029 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8030 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8031 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8032 | spec->autocfg.hp_pins[0] = 0x14; |
| 8033 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8034 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8035 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8036 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8037 | static struct hda_verb alc882_targa_verbs[] = { |
| 8038 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8039 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8040 | |
| 8041 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8042 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8043 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8044 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8045 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8046 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8047 | |
| 8048 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8049 | { } /* end */ |
| 8050 | }; |
| 8051 | |
| 8052 | /* toggle speaker-output according to the hp-jack state */ |
| 8053 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8054 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8055 | struct alc_spec *spec = codec->spec; |
| 8056 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8057 | 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] | 8058 | spec->jack_present ? 1 : 3); |
| 8059 | } |
| 8060 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8061 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8062 | { |
| 8063 | struct alc_spec *spec = codec->spec; |
| 8064 | |
| 8065 | spec->autocfg.hp_pins[0] = 0x14; |
| 8066 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8067 | } |
| 8068 | |
| 8069 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8070 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8071 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8072 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8073 | } |
| 8074 | |
| 8075 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8076 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8077 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8078 | |
| 8079 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8080 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8081 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8082 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8083 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8084 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8085 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8086 | |
| 8087 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8088 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8089 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8090 | { } /* end */ |
| 8091 | }; |
| 8092 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8093 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8094 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8095 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8096 | |
| 8097 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8098 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8099 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8100 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8101 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8102 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8103 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8104 | |
| 8105 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8106 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8107 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8108 | { } /* end */ |
| 8109 | }; |
| 8110 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8111 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8112 | { |
| 8113 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8114 | |
| 8115 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8116 | AC_VERB_GET_GPIO_DATA, 0); |
| 8117 | |
| 8118 | if (!muted) |
| 8119 | gpiostate |= (1 << pin); |
| 8120 | else |
| 8121 | gpiostate &= ~(1 << pin); |
| 8122 | |
| 8123 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8124 | AC_VERB_GET_GPIO_MASK, 0); |
| 8125 | gpiomask |= (1 << pin); |
| 8126 | |
| 8127 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8128 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8129 | gpiodir |= (1 << pin); |
| 8130 | |
| 8131 | |
| 8132 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8133 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8134 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8135 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8136 | |
| 8137 | msleep(1); |
| 8138 | |
| 8139 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8140 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8141 | } |
| 8142 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8143 | /* set up GPIO at initialization */ |
| 8144 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8145 | { |
| 8146 | alc882_gpio_mute(codec, 0, 0); |
| 8147 | alc882_gpio_mute(codec, 1, 0); |
| 8148 | } |
| 8149 | |
| 8150 | /* set up GPIO and update auto-muting at initialization */ |
| 8151 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8152 | { |
| 8153 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8154 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8155 | } |
| 8156 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8157 | /* |
| 8158 | * generic initialization of ADC, input mixers and output mixers |
| 8159 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8160 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8161 | /* |
| 8162 | * Unmute ADC0-2 and set the default input to mic-in |
| 8163 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8164 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8165 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8166 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8167 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8168 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8169 | /* |
| 8170 | * Set up output mixers (0x0c - 0x0f) |
| 8171 | */ |
| 8172 | /* set vol=0 to output mixers */ |
| 8173 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8174 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8175 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8176 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8177 | /* set up input amps for analog loopback */ |
| 8178 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8179 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8180 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8181 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8182 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8183 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8184 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8185 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8186 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8187 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8188 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8189 | |
| 8190 | /* FIXME: use matrix-type input source selection */ |
| 8191 | /* 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] | 8192 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8193 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8194 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8195 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8196 | { } |
| 8197 | }; |
| 8198 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8199 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8200 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8201 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8202 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8203 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8204 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8205 | { } /* end */ |
| 8206 | }; |
| 8207 | |
| 8208 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8209 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8210 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8211 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8212 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8213 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8214 | { } /* end */ |
| 8215 | }; |
| 8216 | |
| 8217 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8218 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8219 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8220 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8221 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8222 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8223 | { } /* end */ |
| 8224 | }; |
| 8225 | |
| 8226 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8227 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8228 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8229 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8230 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8231 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8232 | { } /* end */ |
| 8233 | }; |
| 8234 | |
| 8235 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8236 | { 2, alc889A_mb31_ch2_init }, |
| 8237 | { 4, alc889A_mb31_ch4_init }, |
| 8238 | { 5, alc889A_mb31_ch5_init }, |
| 8239 | { 6, alc889A_mb31_ch6_init }, |
| 8240 | }; |
| 8241 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8242 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8243 | /* eanable EAPD on medion laptop */ |
| 8244 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8245 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8246 | { } |
| 8247 | }; |
| 8248 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8249 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8250 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8251 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8252 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8253 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8254 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8255 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8256 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8257 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8258 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8259 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8260 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8261 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8262 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8263 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8264 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8265 | { } /* end */ |
| 8266 | }; |
| 8267 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8268 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8269 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8270 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8271 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8272 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8273 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8274 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8275 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8276 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8277 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8278 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8279 | { } /* end */ |
| 8280 | }; |
| 8281 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8282 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8283 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8284 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8285 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8286 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8287 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8288 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8289 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8290 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8291 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8292 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8293 | { } /* end */ |
| 8294 | }; |
| 8295 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8296 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8297 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8298 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8299 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8300 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8301 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8302 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8303 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8304 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8305 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8306 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8307 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8308 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8309 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8310 | { } /* end */ |
| 8311 | }; |
| 8312 | |
| 8313 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8314 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8315 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8316 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8317 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8318 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8319 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8320 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8321 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8322 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8323 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8324 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8325 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8326 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8327 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8328 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8329 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8330 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8331 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8332 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8333 | { } /* end */ |
| 8334 | }; |
| 8335 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8336 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8337 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8338 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8339 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8340 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8341 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8342 | HDA_OUTPUT), |
| 8343 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8344 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8345 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8346 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8347 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8348 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8349 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8350 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8351 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8352 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8353 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8354 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8355 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8356 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8357 | { } /* end */ |
| 8358 | }; |
| 8359 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8360 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8361 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8362 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8363 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8364 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8365 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8366 | HDA_OUTPUT), |
| 8367 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8368 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8369 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8370 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8371 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8372 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8373 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8374 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8375 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 8376 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 8377 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8378 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8379 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8380 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8381 | { } /* end */ |
| 8382 | }; |
| 8383 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8384 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8385 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8386 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8387 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8388 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8389 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8390 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8391 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8392 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8393 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8394 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8395 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8396 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8397 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8398 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8399 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8400 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8401 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8402 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8403 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8404 | { } /* end */ |
| 8405 | }; |
| 8406 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8407 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8408 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8409 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8410 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8411 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8412 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8413 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8414 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8415 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8416 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8417 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8418 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8419 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8420 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8421 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8422 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8423 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8424 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8425 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8426 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8427 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8428 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8429 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8430 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8431 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8432 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8433 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8434 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8435 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8436 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8437 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8438 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8439 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8440 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8441 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8442 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8443 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8444 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 8445 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8446 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8447 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8448 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8449 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8450 | { } /* end */ |
| 8451 | }; |
| 8452 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8453 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8454 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8455 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8456 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8457 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8458 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8459 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8460 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8461 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8462 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8463 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8464 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8465 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8466 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8467 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8468 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8469 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8470 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8471 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8472 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8473 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8474 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8475 | { } /* end */ |
| 8476 | }; |
| 8477 | |
| 8478 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8479 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8480 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8481 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8482 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8483 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8484 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8485 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8486 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8487 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8488 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8489 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8490 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 8491 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 8492 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8493 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8494 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8495 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 8496 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 8497 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 8498 | { } /* end */ |
| 8499 | }; |
| 8500 | |
| 8501 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 8502 | /* Unmute front mixer */ |
| 8503 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8504 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8505 | |
| 8506 | /* Set speaker pin to front mixer */ |
| 8507 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8508 | |
| 8509 | /* Init headphone pin */ |
| 8510 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8511 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8512 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8513 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8514 | |
| 8515 | { } /* end */ |
| 8516 | }; |
| 8517 | |
| 8518 | /* toggle speaker-output according to the hp-jack state */ |
| 8519 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 8520 | { |
| 8521 | struct alc_spec *spec = codec->spec; |
| 8522 | |
| 8523 | spec->autocfg.hp_pins[0] = 0x1a; |
| 8524 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8525 | } |
| 8526 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8527 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8528 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8529 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8530 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8531 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8532 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8533 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8534 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8535 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8536 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8537 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8538 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8539 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8540 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8541 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 8542 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8543 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8544 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8545 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8546 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8547 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8548 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8549 | { } /* end */ |
| 8550 | }; |
| 8551 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8552 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8553 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8554 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8555 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8556 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8557 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8558 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8559 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8560 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8561 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8562 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8563 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8564 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8565 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8566 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8567 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8568 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8569 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8570 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8571 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8572 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8573 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8574 | { } /* end */ |
| 8575 | }; |
| 8576 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8577 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8578 | /* Output mixers */ |
| 8579 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8580 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8581 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8582 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8583 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8584 | HDA_OUTPUT), |
| 8585 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8586 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8587 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8588 | /* Output switches */ |
| 8589 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8590 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8591 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8592 | /* Boost mixers */ |
| 8593 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8594 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8595 | /* Input mixers */ |
| 8596 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8597 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, 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 | { } /* end */ |
| 8601 | }; |
| 8602 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8603 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8604 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8605 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8606 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8607 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8608 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8609 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8610 | { } /* end */ |
| 8611 | }; |
| 8612 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8613 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8614 | .ops = &snd_hda_bind_vol, |
| 8615 | .values = { |
| 8616 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8617 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8618 | 0 |
| 8619 | }, |
| 8620 | }; |
| 8621 | |
| 8622 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8623 | .ops = &snd_hda_bind_sw, |
| 8624 | .values = { |
| 8625 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8626 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8627 | 0 |
| 8628 | }, |
| 8629 | }; |
| 8630 | |
| 8631 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8632 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8633 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8634 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8635 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8636 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8637 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8638 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8639 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8640 | { } /* end */ |
| 8641 | }; |
| 8642 | |
| 8643 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8644 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8645 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8646 | { |
| 8647 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8648 | /* .name = "Capture Source", */ |
| 8649 | .name = "Input Source", |
| 8650 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8651 | .info = alc_mux_enum_info, |
| 8652 | .get = alc_mux_enum_get, |
| 8653 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8654 | }, |
| 8655 | { } /* end */ |
| 8656 | }; |
| 8657 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8658 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8659 | { |
| 8660 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8661 | .name = "Channel Mode", |
| 8662 | .info = alc_ch_mode_info, |
| 8663 | .get = alc_ch_mode_get, |
| 8664 | .put = alc_ch_mode_put, |
| 8665 | }, |
| 8666 | { } /* end */ |
| 8667 | }; |
| 8668 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8669 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8670 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8671 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8672 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8673 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8674 | spec->autocfg.hp_pins[0] = 0x15; |
| 8675 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8676 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8677 | } |
| 8678 | |
| 8679 | /* auto-toggle front mic */ |
| 8680 | /* |
| 8681 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8682 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8683 | 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] | 8684 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8685 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8686 | } |
| 8687 | */ |
| 8688 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8689 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8690 | /* HP */ |
| 8691 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8692 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8693 | /* Subwoofer */ |
| 8694 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8695 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8696 | |
| 8697 | /* enable unsolicited event */ |
| 8698 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8699 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8700 | |
| 8701 | { } /* end */ |
| 8702 | }; |
| 8703 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8704 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 8705 | /* HP */ |
| 8706 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8707 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8708 | /* Int speaker */ |
| 8709 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 8710 | |
| 8711 | /* enable unsolicited event */ |
| 8712 | /* |
| 8713 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8714 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8715 | */ |
| 8716 | |
| 8717 | { } /* end */ |
| 8718 | }; |
| 8719 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8720 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8721 | /* HP */ |
| 8722 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8723 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8724 | /* Int speaker */ |
| 8725 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8726 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8727 | |
| 8728 | /* enable unsolicited event */ |
| 8729 | {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] | 8730 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8731 | |
| 8732 | { } /* end */ |
| 8733 | }; |
| 8734 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8735 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8736 | /* HP */ |
| 8737 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8738 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8739 | /* Subwoofer */ |
| 8740 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8741 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8742 | |
| 8743 | /* enable unsolicited event */ |
| 8744 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8745 | |
| 8746 | { } /* end */ |
| 8747 | }; |
| 8748 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8749 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8750 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8751 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8752 | |
| 8753 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8754 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8755 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8756 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8757 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8758 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8759 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8760 | /* Connect Mic jack to CLFE */ |
| 8761 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8762 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8763 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8764 | /* Connect Line-in jack to Surround */ |
| 8765 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8766 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8767 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8768 | /* Connect HP out jack to Front */ |
| 8769 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8770 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8771 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8772 | |
| 8773 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8774 | |
| 8775 | { } /* end */ |
| 8776 | }; |
| 8777 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8778 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8779 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8780 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8781 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8782 | { } /* end */ |
| 8783 | }; |
| 8784 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8785 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8786 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8787 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8788 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8789 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8790 | { } /* end */ |
| 8791 | }; |
| 8792 | |
| 8793 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8794 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8795 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8796 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8797 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8798 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8799 | { } /* end */ |
| 8800 | }; |
| 8801 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8802 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8803 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8804 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8805 | |
| 8806 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8807 | |
| 8808 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8809 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8810 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8811 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8812 | { } /* end */ |
| 8813 | }; |
| 8814 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8815 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8816 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8817 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8818 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8819 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8820 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8821 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8822 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8823 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8824 | { } /* end */ |
| 8825 | }; |
| 8826 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8827 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8828 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8829 | { } |
| 8830 | }; |
| 8831 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8832 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8833 | /* HP */ |
| 8834 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8835 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8836 | |
| 8837 | /* enable unsolicited event */ |
| 8838 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8839 | |
| 8840 | { } /* end */ |
| 8841 | }; |
| 8842 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8843 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8844 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8845 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8846 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8847 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8848 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8849 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8850 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8851 | } |
| 8852 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8853 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8854 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8855 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8856 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8857 | {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] | 8858 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8859 | }; |
| 8860 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8861 | /* |
| 8862 | * 2ch mode |
| 8863 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8864 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8865 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8866 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8867 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8868 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8869 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8870 | }; |
| 8871 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8872 | /* |
| 8873 | * 4ch mode |
| 8874 | */ |
| 8875 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8876 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8877 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8878 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8879 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8880 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8881 | { } /* end */ |
| 8882 | }; |
| 8883 | |
| 8884 | /* |
| 8885 | * 6ch mode |
| 8886 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8887 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8888 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8889 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8890 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8891 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8892 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8893 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8894 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8895 | }; |
| 8896 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8897 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8898 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8899 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8900 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8901 | }; |
| 8902 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8903 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8904 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8905 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8906 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8907 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8908 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8909 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8910 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8911 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8912 | } |
| 8913 | |
| 8914 | /* toggle RCA according to the front-jack state */ |
| 8915 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8916 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8917 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8918 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8919 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8920 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8921 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8922 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8923 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8924 | unsigned int res) |
| 8925 | { |
| 8926 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8927 | alc888_lenovo_ms7195_front_automute(codec); |
| 8928 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8929 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8930 | } |
| 8931 | |
| 8932 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8933 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8934 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8935 | |
| 8936 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8937 | |
| 8938 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8939 | { } /* end */ |
| 8940 | }; |
| 8941 | |
| 8942 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8943 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8944 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8945 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8946 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8947 | spec->autocfg.hp_pins[0] = 0x14; |
| 8948 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8949 | } |
| 8950 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8951 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8952 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8953 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8954 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8955 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8956 | { |
| 8957 | unsigned int present; |
| 8958 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 8959 | present = snd_hda_jack_detect(codec, 0x18); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8960 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8961 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8962 | } |
| 8963 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8964 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8965 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8966 | struct alc_spec *spec = codec->spec; |
| 8967 | |
| 8968 | spec->autocfg.hp_pins[0] = 0x15; |
| 8969 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8970 | } |
| 8971 | |
| 8972 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 8973 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8974 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8975 | alc883_clevo_m720_mic_automute(codec); |
| 8976 | } |
| 8977 | |
| 8978 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8979 | unsigned int res) |
| 8980 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8981 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8982 | case ALC880_MIC_EVENT: |
| 8983 | alc883_clevo_m720_mic_automute(codec); |
| 8984 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8985 | default: |
| 8986 | alc_automute_amp_unsol_event(codec, res); |
| 8987 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8988 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8989 | } |
| 8990 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8991 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8992 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8993 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8994 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8995 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8996 | spec->autocfg.hp_pins[0] = 0x14; |
| 8997 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8998 | } |
| 8999 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9000 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9001 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9002 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9003 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9004 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9005 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9006 | } |
| 9007 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9008 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9009 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9010 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9011 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9012 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9013 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9014 | } |
| 9015 | |
| 9016 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9017 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9018 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9019 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9020 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9021 | HDA_AMP_MUTE, bits); |
| 9022 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9023 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9024 | } |
| 9025 | |
| 9026 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9027 | unsigned int res) |
| 9028 | { |
| 9029 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9030 | alc883_lenovo_101e_all_automute(codec); |
| 9031 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9032 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9033 | } |
| 9034 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9035 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9036 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9037 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9038 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9039 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9040 | spec->autocfg.hp_pins[0] = 0x14; |
| 9041 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9042 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9043 | } |
| 9044 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9045 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9046 | /* HP Pin: output 0 (0x0c) */ |
| 9047 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9048 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9049 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9050 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9051 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9052 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9053 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9054 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9055 | /* eanable EAPD on medion laptop */ |
| 9056 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9057 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9058 | /* enable unsolicited event */ |
| 9059 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9060 | { } |
| 9061 | }; |
| 9062 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9063 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 9064 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9065 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9066 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9067 | { } /* end */ |
| 9068 | }; |
| 9069 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9070 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9071 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9072 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9073 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9074 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9075 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9076 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9077 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9078 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9079 | } |
| 9080 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9081 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9082 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9083 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9084 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9085 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9086 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9087 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9088 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9089 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9090 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9091 | } |
| 9092 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9093 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9094 | { |
| 9095 | struct alc_spec *spec = codec->spec; |
| 9096 | |
| 9097 | spec->autocfg.hp_pins[0] = 0x15; |
| 9098 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9099 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9100 | } |
| 9101 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9102 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9103 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9104 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9105 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9106 | /* enable unsolicited event */ |
| 9107 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9108 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9109 | { } /* end */ |
| 9110 | }; |
| 9111 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9112 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9113 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9114 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9115 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9116 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9117 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9118 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9119 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9120 | spec->ext_mic.pin = 0x18; |
| 9121 | spec->int_mic.pin = 0x19; |
| 9122 | spec->ext_mic.mux_idx = 0; |
| 9123 | spec->int_mic.mux_idx = 1; |
| 9124 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9125 | } |
| 9126 | |
| 9127 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9128 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9129 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9130 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9131 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9132 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9133 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9134 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9135 | /* enable unsolicited event */ |
| 9136 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9137 | { } /* end */ |
| 9138 | }; |
| 9139 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9140 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9141 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9142 | struct alc_spec *spec = codec->spec; |
| 9143 | |
| 9144 | spec->autocfg.hp_pins[0] = 0x14; |
| 9145 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9146 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9147 | } |
| 9148 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9149 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9150 | /* Init rear pin (used as headphone output) */ |
| 9151 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9152 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9153 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9154 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9155 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9156 | /* Init line 2 pin (used as headphone out by default) */ |
| 9157 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9158 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9159 | { } /* end */ |
| 9160 | }; |
| 9161 | |
| 9162 | /* Mute speakers according to the headphone jack state */ |
| 9163 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9164 | { |
| 9165 | unsigned int present; |
| 9166 | |
| 9167 | /* Mute only in 2ch or 4ch mode */ |
| 9168 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9169 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9170 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9171 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9172 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9173 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9174 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9175 | } |
| 9176 | } |
| 9177 | |
| 9178 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9179 | { |
| 9180 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9181 | alc889A_mb31_automute(codec); |
| 9182 | } |
| 9183 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9184 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9185 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9186 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9187 | #endif |
| 9188 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9189 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9190 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9191 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9192 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9193 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9194 | |
| 9195 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9196 | ALC1200_DIGOUT_NID, 0, |
| 9197 | }; |
| 9198 | |
| 9199 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9200 | ALC883_DIGOUT_NID, 0, |
| 9201 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9202 | |
| 9203 | /* |
| 9204 | * configuration and preset |
| 9205 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9206 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 9207 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9208 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9209 | [ALC882_ARIMA] = "arima", |
| 9210 | [ALC882_W2JC] = "w2jc", |
| 9211 | [ALC882_TARGA] = "targa", |
| 9212 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9213 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9214 | [ALC885_MACPRO] = "macpro", |
| 9215 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9216 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9217 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9218 | [ALC885_MBP3] = "mbp3", |
| 9219 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9220 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9221 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9222 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9223 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9224 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9225 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9226 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9227 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9228 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9229 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9230 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9231 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9232 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9233 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9234 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9235 | [ALC883_MEDION_MD2] = "medion-md2", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9236 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9237 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9238 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9239 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9240 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9241 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9242 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9243 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9244 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9245 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9246 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9247 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9248 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9249 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9250 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9251 | [ALC889A_INTEL] = "intel-alc889a", |
| 9252 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9253 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9254 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9255 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9256 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9257 | }; |
| 9258 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9259 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9260 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9261 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9262 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9263 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9264 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9265 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9266 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9267 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9268 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9269 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9270 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9271 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9272 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9273 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9274 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9275 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9276 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9277 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9278 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9279 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9280 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9281 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9282 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9283 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9284 | /* default Acer -- disabled as it causes more problems. |
| 9285 | * model=auto should work fine now |
| 9286 | */ |
| 9287 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9288 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9289 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9290 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9291 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9292 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9293 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9294 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9295 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9296 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9297 | |
| 9298 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9299 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9300 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9301 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9302 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9303 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9304 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9305 | 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] | 9306 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9307 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9308 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9309 | |
| 9310 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9311 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9312 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9313 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9314 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9315 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9316 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9317 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9318 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9319 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9320 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9321 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9322 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9323 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9324 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9325 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9326 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9327 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9328 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9329 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9330 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9331 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9332 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9333 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9334 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9335 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9336 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9337 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9338 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9339 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9340 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9341 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9342 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9343 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9344 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9345 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9346 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9347 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9348 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9349 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9350 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9351 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9352 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9353 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9354 | 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] | 9355 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9356 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9357 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9358 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9359 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9360 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9361 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9362 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9363 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9364 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9365 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9366 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9367 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9368 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9369 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9370 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9371 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9372 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9373 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9374 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9375 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9376 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9377 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9378 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9379 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9380 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9381 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9382 | {} |
| 9383 | }; |
| 9384 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9385 | /* codec SSID table for Intel Mac */ |
| 9386 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9387 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9388 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9389 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9390 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9391 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9392 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9393 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
| 9394 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9395 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9396 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9397 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9398 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9399 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9400 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9401 | */ |
| 9402 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9403 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9404 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9405 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9406 | }; |
| 9407 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9408 | static struct alc_config_preset alc882_presets[] = { |
| 9409 | [ALC882_3ST_DIG] = { |
| 9410 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9411 | .init_verbs = { alc882_base_init_verbs, |
| 9412 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9413 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9414 | .dac_nids = alc882_dac_nids, |
| 9415 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9416 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9417 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9418 | .channel_mode = alc882_ch_modes, |
| 9419 | .need_dac_fix = 1, |
| 9420 | .input_mux = &alc882_capture_source, |
| 9421 | }, |
| 9422 | [ALC882_6ST_DIG] = { |
| 9423 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9424 | .init_verbs = { alc882_base_init_verbs, |
| 9425 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9426 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9427 | .dac_nids = alc882_dac_nids, |
| 9428 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9429 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9430 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9431 | .channel_mode = alc882_sixstack_modes, |
| 9432 | .input_mux = &alc882_capture_source, |
| 9433 | }, |
| 9434 | [ALC882_ARIMA] = { |
| 9435 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9436 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9437 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9438 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9439 | .dac_nids = alc882_dac_nids, |
| 9440 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9441 | .channel_mode = alc882_sixstack_modes, |
| 9442 | .input_mux = &alc882_capture_source, |
| 9443 | }, |
| 9444 | [ALC882_W2JC] = { |
| 9445 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9446 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9447 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9448 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9449 | .dac_nids = alc882_dac_nids, |
| 9450 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9451 | .channel_mode = alc880_threestack_modes, |
| 9452 | .need_dac_fix = 1, |
| 9453 | .input_mux = &alc882_capture_source, |
| 9454 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9455 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9456 | [ALC885_MBA21] = { |
| 9457 | .mixers = { alc885_mba21_mixer }, |
| 9458 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 9459 | .num_dacs = 2, |
| 9460 | .dac_nids = alc882_dac_nids, |
| 9461 | .channel_mode = alc885_mba21_ch_modes, |
| 9462 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9463 | .input_mux = &alc882_capture_source, |
| 9464 | .unsol_event = alc_automute_amp_unsol_event, |
| 9465 | .setup = alc885_mba21_setup, |
| 9466 | .init_hook = alc_automute_amp, |
| 9467 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9468 | [ALC885_MBP3] = { |
| 9469 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 9470 | .init_verbs = { alc885_mbp3_init_verbs, |
| 9471 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9472 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9473 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9474 | .hp_nid = 0x04, |
| 9475 | .channel_mode = alc885_mbp_4ch_modes, |
| 9476 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9477 | .input_mux = &alc882_capture_source, |
| 9478 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9479 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9480 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9481 | .setup = alc885_mbp3_setup, |
| 9482 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9483 | }, |
| 9484 | [ALC885_MB5] = { |
| 9485 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 9486 | .init_verbs = { alc885_mb5_init_verbs, |
| 9487 | alc880_gpio1_init_verbs }, |
| 9488 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9489 | .dac_nids = alc882_dac_nids, |
| 9490 | .channel_mode = alc885_mb5_6ch_modes, |
| 9491 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 9492 | .input_mux = &mb5_capture_source, |
| 9493 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9494 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9495 | .unsol_event = alc_automute_amp_unsol_event, |
| 9496 | .setup = alc885_mb5_setup, |
| 9497 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9498 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9499 | [ALC885_MACMINI3] = { |
| 9500 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 9501 | .init_verbs = { alc885_macmini3_init_verbs, |
| 9502 | alc880_gpio1_init_verbs }, |
| 9503 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9504 | .dac_nids = alc882_dac_nids, |
| 9505 | .channel_mode = alc885_macmini3_6ch_modes, |
| 9506 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 9507 | .input_mux = &macmini3_capture_source, |
| 9508 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9509 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9510 | .unsol_event = alc_automute_amp_unsol_event, |
| 9511 | .setup = alc885_macmini3_setup, |
| 9512 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9513 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9514 | [ALC885_MACPRO] = { |
| 9515 | .mixers = { alc882_macpro_mixer }, |
| 9516 | .init_verbs = { alc882_macpro_init_verbs }, |
| 9517 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9518 | .dac_nids = alc882_dac_nids, |
| 9519 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9520 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9521 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9522 | .channel_mode = alc882_ch_modes, |
| 9523 | .input_mux = &alc882_capture_source, |
| 9524 | .init_hook = alc885_macpro_init_hook, |
| 9525 | }, |
| 9526 | [ALC885_IMAC24] = { |
| 9527 | .mixers = { alc885_imac24_mixer }, |
| 9528 | .init_verbs = { alc885_imac24_init_verbs }, |
| 9529 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9530 | .dac_nids = alc882_dac_nids, |
| 9531 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9532 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9533 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9534 | .channel_mode = alc882_ch_modes, |
| 9535 | .input_mux = &alc882_capture_source, |
| 9536 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9537 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9538 | .init_hook = alc885_imac24_init_hook, |
| 9539 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9540 | [ALC885_IMAC91] = { |
| 9541 | .mixers = { alc885_imac91_mixer, alc882_chmode_mixer }, |
| 9542 | .init_verbs = { alc885_imac91_init_verbs, |
| 9543 | alc880_gpio1_init_verbs }, |
| 9544 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9545 | .dac_nids = alc882_dac_nids, |
| 9546 | .channel_mode = alc885_mbp_4ch_modes, |
| 9547 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
| 9548 | .input_mux = &alc882_capture_source, |
| 9549 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9550 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9551 | .unsol_event = alc_automute_amp_unsol_event, |
| 9552 | .setup = alc885_imac91_setup, |
| 9553 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9554 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9555 | [ALC882_TARGA] = { |
| 9556 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9557 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 9558 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9559 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9560 | .dac_nids = alc882_dac_nids, |
| 9561 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9562 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9563 | .adc_nids = alc882_adc_nids, |
| 9564 | .capsrc_nids = alc882_capsrc_nids, |
| 9565 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9566 | .channel_mode = alc882_3ST_6ch_modes, |
| 9567 | .need_dac_fix = 1, |
| 9568 | .input_mux = &alc882_capture_source, |
| 9569 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9570 | .setup = alc882_targa_setup, |
| 9571 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9572 | }, |
| 9573 | [ALC882_ASUS_A7J] = { |
| 9574 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9575 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9576 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9577 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9578 | .dac_nids = alc882_dac_nids, |
| 9579 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9580 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9581 | .adc_nids = alc882_adc_nids, |
| 9582 | .capsrc_nids = alc882_capsrc_nids, |
| 9583 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9584 | .channel_mode = alc882_3ST_6ch_modes, |
| 9585 | .need_dac_fix = 1, |
| 9586 | .input_mux = &alc882_capture_source, |
| 9587 | }, |
| 9588 | [ALC882_ASUS_A7M] = { |
| 9589 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9590 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9591 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9592 | alc882_asus_a7m_verbs }, |
| 9593 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9594 | .dac_nids = alc882_dac_nids, |
| 9595 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9596 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9597 | .channel_mode = alc880_threestack_modes, |
| 9598 | .need_dac_fix = 1, |
| 9599 | .input_mux = &alc882_capture_source, |
| 9600 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9601 | [ALC883_3ST_2ch_DIG] = { |
| 9602 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9603 | .init_verbs = { alc883_init_verbs }, |
| 9604 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9605 | .dac_nids = alc883_dac_nids, |
| 9606 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9607 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9608 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9609 | .channel_mode = alc883_3ST_2ch_modes, |
| 9610 | .input_mux = &alc883_capture_source, |
| 9611 | }, |
| 9612 | [ALC883_3ST_6ch_DIG] = { |
| 9613 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9614 | .init_verbs = { alc883_init_verbs }, |
| 9615 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9616 | .dac_nids = alc883_dac_nids, |
| 9617 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9618 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9619 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9620 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9621 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9622 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9623 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9624 | [ALC883_3ST_6ch] = { |
| 9625 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9626 | .init_verbs = { alc883_init_verbs }, |
| 9627 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9628 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9629 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9630 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9631 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9632 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9633 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9634 | [ALC883_3ST_6ch_INTEL] = { |
| 9635 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9636 | .init_verbs = { alc883_init_verbs }, |
| 9637 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9638 | .dac_nids = alc883_dac_nids, |
| 9639 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9640 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9641 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9642 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9643 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9644 | .need_dac_fix = 1, |
| 9645 | .input_mux = &alc883_3stack_6ch_intel, |
| 9646 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9647 | [ALC889A_INTEL] = { |
| 9648 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9649 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 9650 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9651 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9652 | .dac_nids = alc883_dac_nids, |
| 9653 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9654 | .adc_nids = alc889_adc_nids, |
| 9655 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9656 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9657 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9658 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9659 | .channel_mode = alc889_8ch_intel_modes, |
| 9660 | .capsrc_nids = alc889_capsrc_nids, |
| 9661 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9662 | .setup = alc889_automute_setup, |
| 9663 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9664 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9665 | .need_dac_fix = 1, |
| 9666 | }, |
| 9667 | [ALC889_INTEL] = { |
| 9668 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9669 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9670 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9671 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9672 | .dac_nids = alc883_dac_nids, |
| 9673 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9674 | .adc_nids = alc889_adc_nids, |
| 9675 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9676 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9677 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9678 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9679 | .channel_mode = alc889_8ch_intel_modes, |
| 9680 | .capsrc_nids = alc889_capsrc_nids, |
| 9681 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9682 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9683 | .init_hook = alc889_intel_init_hook, |
| 9684 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9685 | .need_dac_fix = 1, |
| 9686 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9687 | [ALC883_6ST_DIG] = { |
| 9688 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9689 | .init_verbs = { alc883_init_verbs }, |
| 9690 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9691 | .dac_nids = alc883_dac_nids, |
| 9692 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9693 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9694 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9695 | .channel_mode = alc883_sixstack_modes, |
| 9696 | .input_mux = &alc883_capture_source, |
| 9697 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9698 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9699 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9700 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9701 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9702 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9703 | .dac_nids = alc883_dac_nids, |
| 9704 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9705 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9706 | .channel_mode = alc883_3ST_6ch_modes, |
| 9707 | .need_dac_fix = 1, |
| 9708 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9709 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9710 | .setup = alc882_targa_setup, |
| 9711 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9712 | }, |
| 9713 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9714 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9715 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9716 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9717 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9718 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9719 | .adc_nids = alc883_adc_nids_alt, |
| 9720 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9721 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9722 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9723 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9724 | .channel_mode = alc883_3ST_2ch_modes, |
| 9725 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9726 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9727 | .setup = alc882_targa_setup, |
| 9728 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9729 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9730 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9731 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 9732 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9733 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9734 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9735 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9736 | .dac_nids = alc883_dac_nids, |
| 9737 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9738 | .adc_nids = alc883_adc_nids_rev, |
| 9739 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9740 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9741 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9742 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9743 | .channel_mode = alc883_4ST_8ch_modes, |
| 9744 | .need_dac_fix = 1, |
| 9745 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9746 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9747 | .setup = alc882_targa_setup, |
| 9748 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9749 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9750 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9751 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9752 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9753 | * and the headphone jack. Turn this on and rely on the |
| 9754 | * standard mute methods whenever the user wants to turn |
| 9755 | * these outputs off. |
| 9756 | */ |
| 9757 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9758 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9759 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9760 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9761 | .channel_mode = alc883_3ST_2ch_modes, |
| 9762 | .input_mux = &alc883_capture_source, |
| 9763 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9764 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9765 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9766 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9767 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9768 | .dac_nids = alc883_dac_nids, |
| 9769 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9770 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9771 | .channel_mode = alc883_3ST_2ch_modes, |
| 9772 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9773 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9774 | .setup = alc883_acer_aspire_setup, |
| 9775 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9776 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9777 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9778 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9779 | alc883_chmode_mixer }, |
| 9780 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9781 | alc888_acer_aspire_4930g_verbs }, |
| 9782 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9783 | .dac_nids = alc883_dac_nids, |
| 9784 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9785 | .adc_nids = alc883_adc_nids_rev, |
| 9786 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9787 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9788 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9789 | .channel_mode = alc883_3ST_6ch_modes, |
| 9790 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 9791 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9792 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9793 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9794 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9795 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9796 | .setup = alc888_acer_aspire_4930g_setup, |
| 9797 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9798 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9799 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9800 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9801 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9802 | alc888_acer_aspire_6530g_verbs }, |
| 9803 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9804 | .dac_nids = alc883_dac_nids, |
| 9805 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9806 | .adc_nids = alc883_adc_nids_rev, |
| 9807 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9808 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9809 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9810 | .channel_mode = alc883_3ST_2ch_modes, |
| 9811 | .num_mux_defs = |
| 9812 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9813 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9814 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9815 | .setup = alc888_acer_aspire_6530g_setup, |
| 9816 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9817 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9818 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 9819 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9820 | alc883_chmode_mixer }, |
| 9821 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 9822 | alc889_acer_aspire_8930g_verbs, |
| 9823 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9824 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9825 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9826 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9827 | .adc_nids = alc889_adc_nids, |
| 9828 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9829 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9830 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9831 | .channel_mode = alc883_3ST_6ch_modes, |
| 9832 | .need_dac_fix = 1, |
| 9833 | .const_channel_count = 6, |
| 9834 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9835 | ARRAY_SIZE(alc889_capture_sources), |
| 9836 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9837 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9838 | .setup = alc889_acer_aspire_8930g_setup, |
| 9839 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 9840 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 9841 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 9842 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9843 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9844 | [ALC888_ACER_ASPIRE_7730G] = { |
| 9845 | .mixers = { alc883_3ST_6ch_mixer, |
| 9846 | alc883_chmode_mixer }, |
| 9847 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9848 | alc888_acer_aspire_7730G_verbs }, |
| 9849 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9850 | .dac_nids = alc883_dac_nids, |
| 9851 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9852 | .adc_nids = alc883_adc_nids_rev, |
| 9853 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9854 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9855 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9856 | .channel_mode = alc883_3ST_6ch_modes, |
| 9857 | .need_dac_fix = 1, |
| 9858 | .const_channel_count = 6, |
| 9859 | .input_mux = &alc883_capture_source, |
| 9860 | .unsol_event = alc_automute_amp_unsol_event, |
| 9861 | .setup = alc888_acer_aspire_6530g_setup, |
| 9862 | .init_hook = alc_automute_amp, |
| 9863 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9864 | [ALC883_MEDION] = { |
| 9865 | .mixers = { alc883_fivestack_mixer, |
| 9866 | alc883_chmode_mixer }, |
| 9867 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9868 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9869 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9870 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9871 | .adc_nids = alc883_adc_nids_alt, |
| 9872 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9873 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9874 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9875 | .channel_mode = alc883_sixstack_modes, |
| 9876 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9877 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9878 | [ALC883_MEDION_MD2] = { |
| 9879 | .mixers = { alc883_medion_md2_mixer}, |
| 9880 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9881 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9882 | .dac_nids = alc883_dac_nids, |
| 9883 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9884 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9885 | .channel_mode = alc883_3ST_2ch_modes, |
| 9886 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9887 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9888 | .setup = alc883_medion_md2_setup, |
| 9889 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9890 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9891 | [ALC883_MEDION_WIM2160] = { |
| 9892 | .mixers = { alc883_medion_wim2160_mixer }, |
| 9893 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 9894 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9895 | .dac_nids = alc883_dac_nids, |
| 9896 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9897 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 9898 | .adc_nids = alc883_adc_nids, |
| 9899 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9900 | .channel_mode = alc883_3ST_2ch_modes, |
| 9901 | .input_mux = &alc883_capture_source, |
| 9902 | .unsol_event = alc_automute_amp_unsol_event, |
| 9903 | .setup = alc883_medion_wim2160_setup, |
| 9904 | .init_hook = alc_automute_amp, |
| 9905 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9906 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9907 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9908 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9909 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9910 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9911 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9912 | .channel_mode = alc883_3ST_2ch_modes, |
| 9913 | .input_mux = &alc883_capture_source, |
| 9914 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9915 | [ALC883_CLEVO_M540R] = { |
| 9916 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9917 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 9918 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9919 | .dac_nids = alc883_dac_nids, |
| 9920 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9921 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9922 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 9923 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 9924 | .need_dac_fix = 1, |
| 9925 | .input_mux = &alc883_capture_source, |
| 9926 | /* This machine has the hardware HP auto-muting, thus |
| 9927 | * we need no software mute via unsol event |
| 9928 | */ |
| 9929 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9930 | [ALC883_CLEVO_M720] = { |
| 9931 | .mixers = { alc883_clevo_m720_mixer }, |
| 9932 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9933 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9934 | .dac_nids = alc883_dac_nids, |
| 9935 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9936 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9937 | .channel_mode = alc883_3ST_2ch_modes, |
| 9938 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9939 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9940 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9941 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9942 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9943 | [ALC883_LENOVO_101E_2ch] = { |
| 9944 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9945 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9946 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9947 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9948 | .adc_nids = alc883_adc_nids_alt, |
| 9949 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9950 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9951 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9952 | .channel_mode = alc883_3ST_2ch_modes, |
| 9953 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9954 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9955 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9956 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9957 | [ALC883_LENOVO_NB0763] = { |
| 9958 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9959 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9960 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9961 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9962 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9963 | .channel_mode = alc883_3ST_2ch_modes, |
| 9964 | .need_dac_fix = 1, |
| 9965 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9966 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9967 | .setup = alc883_medion_md2_setup, |
| 9968 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9969 | }, |
| 9970 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9971 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9972 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9973 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9974 | .dac_nids = alc883_dac_nids, |
| 9975 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9976 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9977 | .channel_mode = alc883_3ST_6ch_modes, |
| 9978 | .need_dac_fix = 1, |
| 9979 | .input_mux = &alc883_capture_source, |
| 9980 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9981 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9982 | }, |
| 9983 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9984 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9985 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9986 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9987 | .dac_nids = alc883_dac_nids, |
| 9988 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9989 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9990 | .channel_mode = alc883_3ST_2ch_modes, |
| 9991 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9992 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9993 | .setup = alc883_haier_w66_setup, |
| 9994 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9995 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9996 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9997 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9998 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9999 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10000 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10001 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10002 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10003 | .need_dac_fix = 1, |
| 10004 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10005 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10006 | .setup = alc888_3st_hp_setup, |
| 10007 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10008 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10009 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10010 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10011 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10012 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10013 | .dac_nids = alc883_dac_nids, |
| 10014 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10015 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10016 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10017 | .channel_mode = alc883_sixstack_modes, |
| 10018 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10019 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10020 | .setup = alc888_6st_dell_setup, |
| 10021 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10022 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10023 | [ALC883_MITAC] = { |
| 10024 | .mixers = { alc883_mitac_mixer }, |
| 10025 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10026 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10027 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10028 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10029 | .channel_mode = alc883_3ST_2ch_modes, |
| 10030 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10031 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10032 | .setup = alc883_mitac_setup, |
| 10033 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10034 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10035 | [ALC883_FUJITSU_PI2515] = { |
| 10036 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10037 | .init_verbs = { alc883_init_verbs, |
| 10038 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10039 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10040 | .dac_nids = alc883_dac_nids, |
| 10041 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10042 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10043 | .channel_mode = alc883_3ST_2ch_modes, |
| 10044 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10045 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10046 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10047 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10048 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10049 | [ALC888_FUJITSU_XA3530] = { |
| 10050 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10051 | .init_verbs = { alc883_init_verbs, |
| 10052 | alc888_fujitsu_xa3530_verbs }, |
| 10053 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10054 | .dac_nids = alc883_dac_nids, |
| 10055 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10056 | .adc_nids = alc883_adc_nids_rev, |
| 10057 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10058 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10059 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10060 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10061 | .num_mux_defs = |
| 10062 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10063 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10064 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10065 | .setup = alc888_fujitsu_xa3530_setup, |
| 10066 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10067 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10068 | [ALC888_LENOVO_SKY] = { |
| 10069 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10070 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10071 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10072 | .dac_nids = alc883_dac_nids, |
| 10073 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10074 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10075 | .channel_mode = alc883_sixstack_modes, |
| 10076 | .need_dac_fix = 1, |
| 10077 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10078 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10079 | .setup = alc888_lenovo_sky_setup, |
| 10080 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10081 | }, |
| 10082 | [ALC888_ASUS_M90V] = { |
| 10083 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10084 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10085 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10086 | .dac_nids = alc883_dac_nids, |
| 10087 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10088 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10089 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10090 | .channel_mode = alc883_3ST_6ch_modes, |
| 10091 | .need_dac_fix = 1, |
| 10092 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10093 | .unsol_event = alc_sku_unsol_event, |
| 10094 | .setup = alc883_mode2_setup, |
| 10095 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10096 | }, |
| 10097 | [ALC888_ASUS_EEE1601] = { |
| 10098 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10099 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10100 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10101 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10102 | .dac_nids = alc883_dac_nids, |
| 10103 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10104 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10105 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10106 | .channel_mode = alc883_3ST_2ch_modes, |
| 10107 | .need_dac_fix = 1, |
| 10108 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10109 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10110 | .init_hook = alc883_eee1601_inithook, |
| 10111 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10112 | [ALC1200_ASUS_P5Q] = { |
| 10113 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10114 | .init_verbs = { alc883_init_verbs }, |
| 10115 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10116 | .dac_nids = alc883_dac_nids, |
| 10117 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10118 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10119 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10120 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10121 | .channel_mode = alc883_sixstack_modes, |
| 10122 | .input_mux = &alc883_capture_source, |
| 10123 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10124 | [ALC889A_MB31] = { |
| 10125 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10126 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10127 | alc880_gpio1_init_verbs }, |
| 10128 | .adc_nids = alc883_adc_nids, |
| 10129 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10130 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10131 | .dac_nids = alc883_dac_nids, |
| 10132 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10133 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10134 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10135 | .input_mux = &alc889A_mb31_capture_source, |
| 10136 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10137 | .unsol_event = alc889A_mb31_unsol_event, |
| 10138 | .init_hook = alc889A_mb31_automute, |
| 10139 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10140 | [ALC883_SONY_VAIO_TT] = { |
| 10141 | .mixers = { alc883_vaiott_mixer }, |
| 10142 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10143 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10144 | .dac_nids = alc883_dac_nids, |
| 10145 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10146 | .channel_mode = alc883_3ST_2ch_modes, |
| 10147 | .input_mux = &alc883_capture_source, |
| 10148 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10149 | .setup = alc883_vaiott_setup, |
| 10150 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10151 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10152 | }; |
| 10153 | |
| 10154 | |
| 10155 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10156 | * Pin config fixes |
| 10157 | */ |
| 10158 | enum { |
| 10159 | PINFIX_ABIT_AW9D_MAX |
| 10160 | }; |
| 10161 | |
| 10162 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 10163 | { 0x15, 0x01080104 }, /* side */ |
| 10164 | { 0x16, 0x01011012 }, /* rear */ |
| 10165 | { 0x17, 0x01016011 }, /* clfe */ |
| 10166 | { } |
| 10167 | }; |
| 10168 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10169 | static const struct alc_fixup alc882_fixups[] = { |
| 10170 | [PINFIX_ABIT_AW9D_MAX] = { |
| 10171 | .pins = alc882_abit_aw9d_pinfix |
| 10172 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10173 | }; |
| 10174 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10175 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10176 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 10177 | {} |
| 10178 | }; |
| 10179 | |
| 10180 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10181 | * BIOS auto configuration |
| 10182 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10183 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10184 | const struct auto_pin_cfg *cfg) |
| 10185 | { |
| 10186 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10187 | } |
| 10188 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10189 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10190 | hda_nid_t nid, int pin_type, |
| 10191 | int dac_idx) |
| 10192 | { |
| 10193 | /* set as output */ |
| 10194 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10195 | int idx; |
| 10196 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10197 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | f9700d5 | 2010-04-05 23:25:13 +0200 | [diff] [blame] | 10198 | if (dac_idx >= spec->multiout.num_dacs) |
| 10199 | return; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10200 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 10201 | idx = 4; |
Takashi Iwai | f9700d5 | 2010-04-05 23:25:13 +0200 | [diff] [blame] | 10202 | else |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10203 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10204 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 10205 | |
| 10206 | } |
| 10207 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10208 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10209 | { |
| 10210 | struct alc_spec *spec = codec->spec; |
| 10211 | int i; |
| 10212 | |
| 10213 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10214 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10215 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10216 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10217 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10218 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10219 | } |
| 10220 | } |
| 10221 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10222 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10223 | { |
| 10224 | struct alc_spec *spec = codec->spec; |
| 10225 | hda_nid_t pin; |
| 10226 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10227 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10228 | if (pin) /* connect to front */ |
| 10229 | /* use dac 0 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10230 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10231 | pin = spec->autocfg.speaker_pins[0]; |
| 10232 | if (pin) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10233 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10234 | } |
| 10235 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10236 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10237 | { |
| 10238 | struct alc_spec *spec = codec->spec; |
| 10239 | int i; |
| 10240 | |
| 10241 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10242 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10243 | if (!nid) |
| 10244 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 10245 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10246 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10247 | snd_hda_codec_write(codec, nid, 0, |
| 10248 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10249 | AMP_OUT_MUTE); |
| 10250 | } |
| 10251 | } |
| 10252 | |
| 10253 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10254 | { |
| 10255 | struct alc_spec *spec = codec->spec; |
| 10256 | int c; |
| 10257 | |
| 10258 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10259 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10260 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10261 | unsigned int mux_idx; |
| 10262 | const struct hda_input_mux *imux; |
| 10263 | int conns, mute, idx, item; |
| 10264 | |
| 10265 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10266 | ARRAY_SIZE(conn_list)); |
| 10267 | if (conns < 0) |
| 10268 | continue; |
| 10269 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10270 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10271 | if (!imux->num_items && mux_idx > 0) |
| 10272 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10273 | for (idx = 0; idx < conns; idx++) { |
| 10274 | /* if the current connection is the selected one, |
| 10275 | * unmute it as default - otherwise mute it |
| 10276 | */ |
| 10277 | mute = AMP_IN_MUTE(idx); |
| 10278 | for (item = 0; item < imux->num_items; item++) { |
| 10279 | if (imux->items[item].index == idx) { |
| 10280 | if (spec->cur_mux[c] == item) |
| 10281 | mute = AMP_IN_UNMUTE(idx); |
| 10282 | break; |
| 10283 | } |
| 10284 | } |
| 10285 | /* check if we have a selector or mixer |
| 10286 | * we could check for the widget type instead, but |
| 10287 | * just check for Amp-In presence (in case of mixer |
| 10288 | * without amp-in there is something wrong, this |
| 10289 | * function shouldn't be used or capsrc nid is wrong) |
| 10290 | */ |
| 10291 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10292 | snd_hda_codec_write(codec, nid, 0, |
| 10293 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10294 | mute); |
| 10295 | else if (mute != AMP_IN_MUTE(idx)) |
| 10296 | snd_hda_codec_write(codec, nid, 0, |
| 10297 | AC_VERB_SET_CONNECT_SEL, |
| 10298 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10299 | } |
| 10300 | } |
| 10301 | } |
| 10302 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10303 | /* add mic boosts if needed */ |
| 10304 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10305 | { |
| 10306 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10307 | int err; |
| 10308 | hda_nid_t nid; |
| 10309 | |
| 10310 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 10311 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10312 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10313 | "Mic Boost", |
| 10314 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10315 | if (err < 0) |
| 10316 | return err; |
| 10317 | } |
| 10318 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 10319 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10320 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10321 | "Front Mic Boost", |
| 10322 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10323 | if (err < 0) |
| 10324 | return err; |
| 10325 | } |
| 10326 | return 0; |
| 10327 | } |
| 10328 | |
| 10329 | /* almost identical with ALC880 parser... */ |
| 10330 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10331 | { |
| 10332 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10333 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
| 10334 | int i, err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10335 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10336 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10337 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10338 | if (err < 0) |
| 10339 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10340 | if (!spec->autocfg.line_outs) |
| 10341 | return 0; /* can't find valid BIOS pin config */ |
| 10342 | |
| 10343 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10344 | if (err < 0) |
| 10345 | return err; |
| 10346 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10347 | if (err < 0) |
| 10348 | return err; |
| 10349 | err = alc880_auto_create_extra_out(spec, |
| 10350 | spec->autocfg.speaker_pins[0], |
| 10351 | "Speaker"); |
| 10352 | if (err < 0) |
| 10353 | return err; |
| 10354 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10355 | "Headphone"); |
| 10356 | if (err < 0) |
| 10357 | return err; |
| 10358 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10359 | if (err < 0) |
| 10360 | return err; |
| 10361 | |
| 10362 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10363 | |
| 10364 | /* check multiple SPDIF-out (for recent codecs) */ |
| 10365 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 10366 | hda_nid_t dig_nid; |
| 10367 | err = snd_hda_get_connections(codec, |
| 10368 | spec->autocfg.dig_out_pins[i], |
| 10369 | &dig_nid, 1); |
| 10370 | if (err < 0) |
| 10371 | continue; |
| 10372 | if (!i) |
| 10373 | spec->multiout.dig_out_nid = dig_nid; |
| 10374 | else { |
| 10375 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 10376 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10377 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 10378 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10379 | } |
| 10380 | } |
| 10381 | if (spec->autocfg.dig_in_pin) |
| 10382 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 10383 | |
| 10384 | if (spec->kctls.list) |
| 10385 | add_mixer(spec, spec->kctls.list); |
| 10386 | |
| 10387 | add_verb(spec, alc883_auto_init_verbs); |
| 10388 | /* if ADC 0x07 is available, initialize it, too */ |
| 10389 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10390 | add_verb(spec, alc882_adc1_init_verbs); |
| 10391 | |
| 10392 | spec->num_mux_defs = 1; |
| 10393 | spec->input_mux = &spec->private_imux[0]; |
| 10394 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10395 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10396 | |
| 10397 | err = alc_auto_add_mic_boost(codec); |
| 10398 | if (err < 0) |
| 10399 | return err; |
| 10400 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10401 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10402 | } |
| 10403 | |
| 10404 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10405 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10406 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10407 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10408 | alc882_auto_init_multi_out(codec); |
| 10409 | alc882_auto_init_hp_out(codec); |
| 10410 | alc882_auto_init_analog_input(codec); |
| 10411 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10412 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10413 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10414 | } |
| 10415 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10416 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10417 | { |
| 10418 | struct alc_spec *spec; |
| 10419 | int err, board_config; |
| 10420 | |
| 10421 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10422 | if (spec == NULL) |
| 10423 | return -ENOMEM; |
| 10424 | |
| 10425 | codec->spec = spec; |
| 10426 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10427 | switch (codec->vendor_id) { |
| 10428 | case 0x10ec0882: |
| 10429 | case 0x10ec0885: |
| 10430 | break; |
| 10431 | default: |
| 10432 | /* ALC883 and variants */ |
| 10433 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10434 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10435 | } |
| 10436 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10437 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10438 | alc882_models, |
| 10439 | alc882_cfg_tbl); |
| 10440 | |
| 10441 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10442 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10443 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10444 | |
| 10445 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10446 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10447 | codec->chip_name); |
| 10448 | board_config = ALC882_AUTO; |
| 10449 | } |
| 10450 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10451 | if (board_config == ALC882_AUTO) |
| 10452 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10453 | |
| 10454 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10455 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10456 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10457 | if (err < 0) { |
| 10458 | alc_free(codec); |
| 10459 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10460 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10461 | printk(KERN_INFO |
| 10462 | "hda_codec: Cannot set up configuration " |
| 10463 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10464 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10465 | } |
| 10466 | } |
| 10467 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 10468 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 10469 | if (err < 0) { |
| 10470 | alc_free(codec); |
| 10471 | return err; |
| 10472 | } |
| 10473 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10474 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 10475 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10476 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10477 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 10478 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 10479 | /* FIXME: setup DAC5 */ |
| 10480 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 10481 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 10482 | |
| 10483 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 10484 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 10485 | |
| 10486 | if (codec->vendor_id == 0x10ec0888) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 10487 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10488 | |
| 10489 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10490 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10491 | spec->num_adc_nids = 0; |
| 10492 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10493 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10494 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10495 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10496 | hda_nid_t nid = alc882_adc_nids[i]; |
| 10497 | unsigned int wcap = get_wcaps(codec, nid); |
| 10498 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 10499 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10500 | if (wcap != AC_WID_AUD_IN) |
| 10501 | continue; |
| 10502 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 10503 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 10504 | if (err < 0) |
| 10505 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10506 | err = snd_hda_get_connections(codec, cap, items, |
| 10507 | ARRAY_SIZE(items)); |
| 10508 | if (err < 0) |
| 10509 | continue; |
| 10510 | for (j = 0; j < imux->num_items; j++) |
| 10511 | if (imux->items[j].index >= err) |
| 10512 | break; |
| 10513 | if (j < imux->num_items) |
| 10514 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10515 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 10516 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10517 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10518 | spec->adc_nids = spec->private_adc_nids; |
| 10519 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10520 | } |
| 10521 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 10522 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 10523 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10524 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10525 | if (board_config == ALC882_AUTO) |
| 10526 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); |
| 10527 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10528 | spec->vmaster_nid = 0x0c; |
| 10529 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10530 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10531 | if (board_config == ALC882_AUTO) |
| 10532 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10533 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10534 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10535 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10536 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10537 | |
| 10538 | return 0; |
| 10539 | } |
| 10540 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10541 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10542 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10543 | * ALC262 support |
| 10544 | */ |
| 10545 | |
| 10546 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 10547 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 10548 | |
| 10549 | #define alc262_dac_nids alc260_dac_nids |
| 10550 | #define alc262_adc_nids alc882_adc_nids |
| 10551 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10552 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 10553 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10554 | |
| 10555 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 10556 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10557 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10558 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 10559 | /* ADC0 */ |
| 10560 | 0x09 |
| 10561 | }; |
| 10562 | |
| 10563 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 10564 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10565 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 10566 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10567 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10568 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10569 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10570 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10571 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10572 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10573 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10574 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10575 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10576 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10577 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10578 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 10579 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10580 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 10581 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10582 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10583 | }; |
| 10584 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10585 | /* update HP, line and mono-out pins according to the master switch */ |
| 10586 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 10587 | { |
| 10588 | struct alc_spec *spec = codec->spec; |
| 10589 | int val = spec->master_sw; |
| 10590 | |
| 10591 | /* HP & line-out */ |
| 10592 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 10593 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10594 | val ? PIN_HP : 0); |
| 10595 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10596 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10597 | val ? PIN_HP : 0); |
| 10598 | /* mono (speaker) depending on the HP jack sense */ |
| 10599 | val = val && !spec->jack_present; |
| 10600 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 10601 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10602 | val ? PIN_OUT : 0); |
| 10603 | } |
| 10604 | |
| 10605 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 10606 | { |
| 10607 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10608 | |
| 10609 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10610 | alc262_hp_master_update(codec); |
| 10611 | } |
| 10612 | |
| 10613 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10614 | { |
| 10615 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10616 | return; |
| 10617 | alc262_hp_bpc_automute(codec); |
| 10618 | } |
| 10619 | |
| 10620 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 10621 | { |
| 10622 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10623 | |
| 10624 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10625 | alc262_hp_master_update(codec); |
| 10626 | } |
| 10627 | |
| 10628 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 10629 | unsigned int res) |
| 10630 | { |
| 10631 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10632 | return; |
| 10633 | alc262_hp_wildwest_automute(codec); |
| 10634 | } |
| 10635 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10636 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10637 | |
| 10638 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10639 | struct snd_ctl_elem_value *ucontrol) |
| 10640 | { |
| 10641 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10642 | struct alc_spec *spec = codec->spec; |
| 10643 | int val = !!*ucontrol->value.integer.value; |
| 10644 | |
| 10645 | if (val == spec->master_sw) |
| 10646 | return 0; |
| 10647 | spec->master_sw = val; |
| 10648 | alc262_hp_master_update(codec); |
| 10649 | return 1; |
| 10650 | } |
| 10651 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10652 | #define ALC262_HP_MASTER_SWITCH \ |
| 10653 | { \ |
| 10654 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10655 | .name = "Master Playback Switch", \ |
| 10656 | .info = snd_ctl_boolean_mono_info, \ |
| 10657 | .get = alc262_hp_master_sw_get, \ |
| 10658 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10659 | }, \ |
| 10660 | { \ |
| 10661 | .iface = NID_MAPPING, \ |
| 10662 | .name = "Master Playback Switch", \ |
| 10663 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10664 | } |
| 10665 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10666 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10667 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10668 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10669 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10670 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10671 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10672 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10673 | HDA_OUTPUT), |
| 10674 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10675 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10676 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10677 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10678 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10679 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10680 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10681 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10682 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10683 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10684 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10685 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10686 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10687 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10688 | { } /* end */ |
| 10689 | }; |
| 10690 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10691 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10692 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10693 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10694 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10695 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10696 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10697 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10698 | HDA_OUTPUT), |
| 10699 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10700 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10701 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10702 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10703 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10704 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10705 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10706 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10707 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10708 | { } /* end */ |
| 10709 | }; |
| 10710 | |
| 10711 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 10712 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10713 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10714 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10715 | { } /* end */ |
| 10716 | }; |
| 10717 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10718 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10719 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10720 | { |
| 10721 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10722 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10723 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 10724 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10725 | } |
| 10726 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10727 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10728 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10729 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10730 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10731 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10732 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10733 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10734 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10735 | { } /* end */ |
| 10736 | }; |
| 10737 | |
| 10738 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 10739 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10740 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10741 | |
| 10742 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10743 | { } |
| 10744 | }; |
| 10745 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10746 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 10747 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10748 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10749 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 10750 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10751 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10752 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10753 | { } /* end */ |
| 10754 | }; |
| 10755 | |
| 10756 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 10757 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10758 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10759 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10760 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10761 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10762 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10763 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10764 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10765 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10766 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10767 | {} |
| 10768 | }; |
| 10769 | |
| 10770 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10771 | .num_items = 1, |
| 10772 | .items = { |
| 10773 | { "Line", 0x1 }, |
| 10774 | }, |
| 10775 | }; |
| 10776 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10777 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10778 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10779 | { |
| 10780 | struct alc_spec *spec = codec->spec; |
| 10781 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10782 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10783 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10784 | unsigned int mute; |
| 10785 | |
| 10786 | /* HP */ |
| 10787 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 10788 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 10789 | HDA_AMP_MUTE, mute); |
| 10790 | /* mute internal speaker per jack sense */ |
| 10791 | if (spec->jack_present) |
| 10792 | mute = HDA_AMP_MUTE; |
| 10793 | if (line_nid) |
| 10794 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 10795 | HDA_AMP_MUTE, mute); |
| 10796 | if (speaker_nid && speaker_nid != line_nid) |
| 10797 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 10798 | HDA_AMP_MUTE, mute); |
| 10799 | } |
| 10800 | |
| 10801 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 10802 | |
| 10803 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10804 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10805 | { |
| 10806 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10807 | struct alc_spec *spec = codec->spec; |
| 10808 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10809 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10810 | if (val == spec->master_sw) |
| 10811 | return 0; |
| 10812 | spec->master_sw = val; |
| 10813 | alc262_hippo_master_update(codec); |
| 10814 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10815 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10816 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10817 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 10818 | { \ |
| 10819 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10820 | .name = "Master Playback Switch", \ |
| 10821 | .info = snd_ctl_boolean_mono_info, \ |
| 10822 | .get = alc262_hippo_master_sw_get, \ |
| 10823 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10824 | }, \ |
| 10825 | { \ |
| 10826 | .iface = NID_MAPPING, \ |
| 10827 | .name = "Master Playback Switch", \ |
| 10828 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 10829 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10830 | } |
| 10831 | |
| 10832 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 10833 | ALC262_HIPPO_MASTER_SWITCH, |
| 10834 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10835 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10836 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10837 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10838 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10839 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10840 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10841 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10842 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10843 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10844 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10845 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10846 | { } /* end */ |
| 10847 | }; |
| 10848 | |
| 10849 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 10850 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10851 | ALC262_HIPPO_MASTER_SWITCH, |
| 10852 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10853 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10854 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10855 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10856 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10857 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10858 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10859 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10860 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10861 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10862 | { } /* end */ |
| 10863 | }; |
| 10864 | |
| 10865 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10866 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 10867 | { |
| 10868 | struct alc_spec *spec = codec->spec; |
| 10869 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10870 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10871 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10872 | alc262_hippo_master_update(codec); |
| 10873 | } |
| 10874 | |
| 10875 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10876 | { |
| 10877 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10878 | return; |
| 10879 | alc262_hippo_automute(codec); |
| 10880 | } |
| 10881 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10882 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10883 | { |
| 10884 | struct alc_spec *spec = codec->spec; |
| 10885 | |
| 10886 | spec->autocfg.hp_pins[0] = 0x15; |
| 10887 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10888 | } |
| 10889 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10890 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10891 | { |
| 10892 | struct alc_spec *spec = codec->spec; |
| 10893 | |
| 10894 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10895 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10896 | } |
| 10897 | |
| 10898 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10899 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10900 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10901 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10902 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10903 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10904 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10905 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10906 | { } /* end */ |
| 10907 | }; |
| 10908 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10909 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10910 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10911 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10912 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10913 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10914 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10915 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10916 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10917 | { } /* end */ |
| 10918 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10919 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10920 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 10921 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10922 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10923 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10924 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10925 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10926 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10927 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10928 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10929 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10930 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10931 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10932 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10933 | { } /* end */ |
| 10934 | }; |
| 10935 | |
| 10936 | static struct hda_verb alc262_tyan_verbs[] = { |
| 10937 | /* Headphone automute */ |
| 10938 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10939 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10940 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10941 | |
| 10942 | /* P11 AUX_IN, white 4-pin connector */ |
| 10943 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10944 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 10945 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 10946 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 10947 | |
| 10948 | {} |
| 10949 | }; |
| 10950 | |
| 10951 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10952 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10953 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10954 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10955 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10956 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10957 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10958 | } |
| 10959 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10960 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10961 | #define alc262_capture_mixer alc882_capture_mixer |
| 10962 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 10963 | |
| 10964 | /* |
| 10965 | * generic initialization of ADC, input mixers and output mixers |
| 10966 | */ |
| 10967 | static struct hda_verb alc262_init_verbs[] = { |
| 10968 | /* |
| 10969 | * Unmute ADC0-2 and set the default input to mic-in |
| 10970 | */ |
| 10971 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10972 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10973 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10974 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10975 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10976 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10977 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10978 | /* 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] | 10979 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10980 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10981 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10982 | */ |
| 10983 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10984 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10985 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10986 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10987 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10988 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10989 | |
| 10990 | /* |
| 10991 | * Set up output mixers (0x0c - 0x0e) |
| 10992 | */ |
| 10993 | /* set vol=0 to output mixers */ |
| 10994 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10995 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10996 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10997 | /* set up input amps for analog loopback */ |
| 10998 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10999 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11000 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11001 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11002 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11003 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11004 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11005 | |
| 11006 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11007 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11008 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11009 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11010 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11011 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11012 | |
| 11013 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11014 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11015 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11016 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11017 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11018 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11019 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11020 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11021 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11022 | /* FIXME: use matrix-type input source selection */ |
| 11023 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11024 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11025 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11026 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11027 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11028 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11029 | /* Input mixer2 */ |
| 11030 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11031 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11032 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11033 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11034 | /* Input mixer3 */ |
| 11035 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11036 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11037 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11038 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11039 | |
| 11040 | { } |
| 11041 | }; |
| 11042 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11043 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11044 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11045 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11046 | { } |
| 11047 | }; |
| 11048 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11049 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11050 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11051 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11052 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11053 | |
| 11054 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11055 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11056 | {} |
| 11057 | }; |
| 11058 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11059 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11060 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11061 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11062 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11063 | |
| 11064 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11065 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11066 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11067 | }; |
| 11068 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11069 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11070 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11071 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11072 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11073 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11074 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11075 | { } /* end */ |
| 11076 | }; |
| 11077 | |
| 11078 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11079 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11080 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11081 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11082 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11083 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11084 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11085 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11086 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11087 | {} |
| 11088 | }; |
| 11089 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11090 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11091 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11092 | struct alc_spec *spec = codec->spec; |
| 11093 | |
| 11094 | spec->autocfg.hp_pins[0] = 0x15; |
| 11095 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11096 | spec->ext_mic.pin = 0x18; |
| 11097 | spec->ext_mic.mux_idx = 0; |
| 11098 | spec->int_mic.pin = 0x12; |
| 11099 | spec->int_mic.mux_idx = 9; |
| 11100 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11101 | } |
| 11102 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11103 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11104 | * nec model |
| 11105 | * 0x15 = headphone |
| 11106 | * 0x16 = internal speaker |
| 11107 | * 0x18 = external mic |
| 11108 | */ |
| 11109 | |
| 11110 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11111 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11112 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11113 | |
| 11114 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11115 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11116 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11117 | |
| 11118 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11119 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11120 | { } /* end */ |
| 11121 | }; |
| 11122 | |
| 11123 | static struct hda_verb alc262_nec_verbs[] = { |
| 11124 | /* Unmute Speaker */ |
| 11125 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11126 | |
| 11127 | /* Headphone */ |
| 11128 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11129 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11130 | |
| 11131 | /* External mic to headphone */ |
| 11132 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11133 | /* External mic to speaker */ |
| 11134 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11135 | {} |
| 11136 | }; |
| 11137 | |
| 11138 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11139 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11140 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11141 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11142 | */ |
| 11143 | |
| 11144 | #define ALC_HP_EVENT 0x37 |
| 11145 | |
| 11146 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11147 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11148 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11149 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11150 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11151 | {} |
| 11152 | }; |
| 11153 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11154 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11155 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11156 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11157 | {} |
| 11158 | }; |
| 11159 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11160 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11161 | /* Front Mic pin: input vref at 50% */ |
| 11162 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11163 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11164 | {} |
| 11165 | }; |
| 11166 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11167 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11168 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11169 | .items = { |
| 11170 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11171 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11172 | { "CD", 0x4 }, |
| 11173 | }, |
| 11174 | }; |
| 11175 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11176 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11177 | .num_items = 5, |
| 11178 | .items = { |
| 11179 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11180 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11181 | { "Line", 0x2 }, |
| 11182 | { "CD", 0x4 }, |
| 11183 | { "AUX IN", 0x6 }, |
| 11184 | }, |
| 11185 | }; |
| 11186 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11187 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11188 | .num_items = 4, |
| 11189 | .items = { |
| 11190 | { "Mic", 0x0 }, |
| 11191 | { "Front Mic", 0x2 }, |
| 11192 | { "Line", 0x1 }, |
| 11193 | { "CD", 0x4 }, |
| 11194 | }, |
| 11195 | }; |
| 11196 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11197 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11198 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11199 | { |
| 11200 | struct alc_spec *spec = codec->spec; |
| 11201 | unsigned int mute; |
| 11202 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11203 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11204 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11205 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11206 | spec->sense_updated = 1; |
| 11207 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11208 | /* unmute internal speaker only if both HPs are unplugged and |
| 11209 | * master switch is on |
| 11210 | */ |
| 11211 | if (spec->jack_present) |
| 11212 | mute = HDA_AMP_MUTE; |
| 11213 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11214 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11215 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11216 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11217 | } |
| 11218 | |
| 11219 | /* unsolicited event for HP jack sensing */ |
| 11220 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11221 | unsigned int res) |
| 11222 | { |
| 11223 | if ((res >> 26) != ALC_HP_EVENT) |
| 11224 | return; |
| 11225 | alc262_fujitsu_automute(codec, 1); |
| 11226 | } |
| 11227 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11228 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11229 | { |
| 11230 | alc262_fujitsu_automute(codec, 1); |
| 11231 | } |
| 11232 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11233 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11234 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11235 | .ops = &snd_hda_bind_vol, |
| 11236 | .values = { |
| 11237 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11238 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11239 | 0 |
| 11240 | }, |
| 11241 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11242 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11243 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11244 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11245 | { |
| 11246 | struct alc_spec *spec = codec->spec; |
| 11247 | unsigned int mute; |
| 11248 | |
| 11249 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11250 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11251 | spec->sense_updated = 1; |
| 11252 | } |
| 11253 | if (spec->jack_present) { |
| 11254 | /* mute internal speaker */ |
| 11255 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11256 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11257 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11258 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11259 | } else { |
| 11260 | /* unmute internal speaker if necessary */ |
| 11261 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11262 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11263 | HDA_AMP_MUTE, mute); |
| 11264 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11265 | HDA_AMP_MUTE, mute); |
| 11266 | } |
| 11267 | } |
| 11268 | |
| 11269 | /* unsolicited event for HP jack sensing */ |
| 11270 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11271 | unsigned int res) |
| 11272 | { |
| 11273 | if ((res >> 26) != ALC_HP_EVENT) |
| 11274 | return; |
| 11275 | alc262_lenovo_3000_automute(codec, 1); |
| 11276 | } |
| 11277 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11278 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11279 | int dir, int idx, long *valp) |
| 11280 | { |
| 11281 | int i, change = 0; |
| 11282 | |
| 11283 | for (i = 0; i < 2; i++, valp++) |
| 11284 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11285 | HDA_AMP_MUTE, |
| 11286 | *valp ? 0 : HDA_AMP_MUTE); |
| 11287 | return change; |
| 11288 | } |
| 11289 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11290 | /* bind hp and internal speaker mute (with plug check) */ |
| 11291 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11292 | struct snd_ctl_elem_value *ucontrol) |
| 11293 | { |
| 11294 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11295 | long *valp = ucontrol->value.integer.value; |
| 11296 | int change; |
| 11297 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11298 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11299 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11300 | if (change) |
| 11301 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11302 | return change; |
| 11303 | } |
| 11304 | |
| 11305 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11306 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11307 | { |
| 11308 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11309 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11310 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11311 | .info = snd_hda_mixer_amp_switch_info, |
| 11312 | .get = snd_hda_mixer_amp_switch_get, |
| 11313 | .put = alc262_fujitsu_master_sw_put, |
| 11314 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11315 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11316 | { |
| 11317 | .iface = NID_MAPPING, |
| 11318 | .name = "Master Playback Switch", |
| 11319 | .private_value = 0x1b, |
| 11320 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11321 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11322 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11323 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11324 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11325 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11326 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11327 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11328 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11329 | { } /* end */ |
| 11330 | }; |
| 11331 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11332 | /* bind hp and internal speaker mute (with plug check) */ |
| 11333 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11334 | struct snd_ctl_elem_value *ucontrol) |
| 11335 | { |
| 11336 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11337 | long *valp = ucontrol->value.integer.value; |
| 11338 | int change; |
| 11339 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11340 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11341 | if (change) |
| 11342 | alc262_lenovo_3000_automute(codec, 0); |
| 11343 | return change; |
| 11344 | } |
| 11345 | |
| 11346 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11347 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11348 | { |
| 11349 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11350 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11351 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11352 | .info = snd_hda_mixer_amp_switch_info, |
| 11353 | .get = snd_hda_mixer_amp_switch_get, |
| 11354 | .put = alc262_lenovo_3000_master_sw_put, |
| 11355 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11356 | }, |
| 11357 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11358 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11359 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11360 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11361 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11362 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11363 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11364 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11365 | { } /* end */ |
| 11366 | }; |
| 11367 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11368 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11369 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11370 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11371 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11372 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11373 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11374 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11375 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11376 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11377 | { } /* end */ |
| 11378 | }; |
| 11379 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11380 | /* additional init verbs for Benq laptops */ |
| 11381 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11382 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11383 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11384 | {} |
| 11385 | }; |
| 11386 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11387 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11388 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11389 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11390 | |
| 11391 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11392 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11393 | {} |
| 11394 | }; |
| 11395 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11396 | /* Samsung Q1 Ultra Vista model setup */ |
| 11397 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11398 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11399 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11400 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11401 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11402 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11403 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11404 | { } /* end */ |
| 11405 | }; |
| 11406 | |
| 11407 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11408 | /* output mixer */ |
| 11409 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11410 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11411 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11412 | /* speaker */ |
| 11413 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11414 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11415 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11416 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11417 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11418 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11419 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11420 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11421 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11422 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11423 | /* internal mic */ |
| 11424 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11425 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11426 | /* ADC, choose mic */ |
| 11427 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11428 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11429 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11430 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11431 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11432 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11433 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11434 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11435 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11436 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11437 | {} |
| 11438 | }; |
| 11439 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11440 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11441 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11442 | { |
| 11443 | struct alc_spec *spec = codec->spec; |
| 11444 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11445 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11446 | mute = 0; |
| 11447 | /* auto-mute only when HP is used as HP */ |
| 11448 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11449 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11450 | if (spec->jack_present) |
| 11451 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11452 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11453 | /* mute/unmute internal speaker */ |
| 11454 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11455 | HDA_AMP_MUTE, mute); |
| 11456 | /* mute/unmute HP */ |
| 11457 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11458 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11459 | } |
| 11460 | |
| 11461 | /* unsolicited event for HP jack sensing */ |
| 11462 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11463 | unsigned int res) |
| 11464 | { |
| 11465 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11466 | return; |
| 11467 | alc262_ultra_automute(codec); |
| 11468 | } |
| 11469 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11470 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 11471 | .num_items = 2, |
| 11472 | .items = { |
| 11473 | { "Mic", 0x1 }, |
| 11474 | { "Headphone", 0x7 }, |
| 11475 | }, |
| 11476 | }; |
| 11477 | |
| 11478 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11479 | struct snd_ctl_elem_value *ucontrol) |
| 11480 | { |
| 11481 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11482 | struct alc_spec *spec = codec->spec; |
| 11483 | int ret; |
| 11484 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11485 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11486 | if (!ret) |
| 11487 | return 0; |
| 11488 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 11489 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11490 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11491 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 11492 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 11493 | return ret; |
| 11494 | } |
| 11495 | |
| 11496 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 11497 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 11498 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 11499 | { |
| 11500 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11501 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11502 | .info = alc_mux_enum_info, |
| 11503 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11504 | .put = alc262_ultra_mux_enum_put, |
| 11505 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11506 | { |
| 11507 | .iface = NID_MAPPING, |
| 11508 | .name = "Capture Source", |
| 11509 | .private_value = 0x15, |
| 11510 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11511 | { } /* end */ |
| 11512 | }; |
| 11513 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11514 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 11515 | * and thus it's bound with a different mixer. |
| 11516 | * This function returns which mixer amp should be used. |
| 11517 | */ |
| 11518 | static int alc262_check_volbit(hda_nid_t nid) |
| 11519 | { |
| 11520 | if (!nid) |
| 11521 | return 0; |
| 11522 | else if (nid == 0x16) |
| 11523 | return 2; |
| 11524 | else |
| 11525 | return 1; |
| 11526 | } |
| 11527 | |
| 11528 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11529 | const char *pfx, int *vbits) |
| 11530 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11531 | unsigned long val; |
| 11532 | int vbit; |
| 11533 | |
| 11534 | vbit = alc262_check_volbit(nid); |
| 11535 | if (!vbit) |
| 11536 | return 0; |
| 11537 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 11538 | return 0; |
| 11539 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11540 | if (vbit == 2) |
| 11541 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 11542 | else |
| 11543 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11544 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11545 | } |
| 11546 | |
| 11547 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11548 | const char *pfx) |
| 11549 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11550 | unsigned long val; |
| 11551 | |
| 11552 | if (!nid) |
| 11553 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11554 | if (nid == 0x16) |
| 11555 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 11556 | else |
| 11557 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11558 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11559 | } |
| 11560 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11561 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11562 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11563 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11564 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11565 | const char *pfx; |
| 11566 | int vbits; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11567 | int err; |
| 11568 | |
| 11569 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11570 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11571 | spec->multiout.dac_nids[0] = 2; |
| 11572 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11573 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 11574 | pfx = "Master"; |
| 11575 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11576 | pfx = "Speaker"; |
| 11577 | else |
| 11578 | pfx = "Front"; |
| 11579 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); |
| 11580 | if (err < 0) |
| 11581 | return err; |
| 11582 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); |
| 11583 | if (err < 0) |
| 11584 | return err; |
| 11585 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); |
| 11586 | if (err < 0) |
| 11587 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11588 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11589 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 11590 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 11591 | alc262_check_volbit(cfg->hp_pins[0]); |
| 11592 | if (vbits == 1 || vbits == 2) |
| 11593 | pfx = "Master"; /* only one mixer is used */ |
| 11594 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11595 | pfx = "Speaker"; |
| 11596 | else |
| 11597 | pfx = "Front"; |
| 11598 | vbits = 0; |
| 11599 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); |
| 11600 | if (err < 0) |
| 11601 | return err; |
| 11602 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", |
| 11603 | &vbits); |
| 11604 | if (err < 0) |
| 11605 | return err; |
| 11606 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", |
| 11607 | &vbits); |
| 11608 | if (err < 0) |
| 11609 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11610 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11611 | } |
| 11612 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11613 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 11614 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11615 | |
| 11616 | /* |
| 11617 | * generic initialization of ADC, input mixers and output mixers |
| 11618 | */ |
| 11619 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 11620 | /* |
| 11621 | * Unmute ADC0-2 and set the default input to mic-in |
| 11622 | */ |
| 11623 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11624 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11625 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11626 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11627 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11628 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11629 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11630 | /* 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] | 11631 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11632 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11633 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11634 | */ |
| 11635 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11636 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11637 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11638 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11639 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11640 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11641 | |
| 11642 | /* |
| 11643 | * Set up output mixers (0x0c - 0x0f) |
| 11644 | */ |
| 11645 | /* set vol=0 to output mixers */ |
| 11646 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11647 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11648 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11649 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11650 | /* set up input amps for analog loopback */ |
| 11651 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11652 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11653 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11654 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11655 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11656 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11657 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11658 | |
| 11659 | /* FIXME: use matrix-type input source selection */ |
| 11660 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11661 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11662 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11663 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11664 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11665 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11666 | /* Input mixer2 */ |
| 11667 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11668 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11669 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11670 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11671 | /* Input mixer3 */ |
| 11672 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11673 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11674 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11675 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11676 | |
| 11677 | { } |
| 11678 | }; |
| 11679 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11680 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 11681 | /* |
| 11682 | * Unmute ADC0-2 and set the default input to mic-in |
| 11683 | */ |
| 11684 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11685 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11686 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11687 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11688 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11689 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11690 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11691 | /* 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] | 11692 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11693 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11694 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11695 | */ |
| 11696 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11697 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11698 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11699 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11700 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11701 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11702 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11703 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11704 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11705 | /* |
| 11706 | * Set up output mixers (0x0c - 0x0e) |
| 11707 | */ |
| 11708 | /* set vol=0 to output mixers */ |
| 11709 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11710 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11711 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11712 | |
| 11713 | /* set up input amps for analog loopback */ |
| 11714 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11715 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11716 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11717 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11718 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11719 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11720 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11721 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11722 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11723 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11724 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11725 | |
| 11726 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11727 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11728 | |
| 11729 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11730 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11731 | |
| 11732 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11733 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11734 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11735 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11736 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11737 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11738 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11739 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11740 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11741 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11742 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11743 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11744 | |
| 11745 | |
| 11746 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11747 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11748 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11749 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11750 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11751 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11752 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11753 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11754 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11755 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11756 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11757 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11758 | /* Input mixer2 */ |
| 11759 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11760 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11761 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11762 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11763 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11764 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11765 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11766 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11767 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11768 | /* Input mixer3 */ |
| 11769 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11770 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11771 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11772 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11773 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11774 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11775 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11776 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11777 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11778 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11779 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11780 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11781 | { } |
| 11782 | }; |
| 11783 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11784 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11785 | /* |
| 11786 | * Unmute ADC0-2 and set the default input to mic-in |
| 11787 | */ |
| 11788 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11789 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11790 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11791 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11792 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11793 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11794 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11795 | /* 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] | 11796 | * mixer widget |
| 11797 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11798 | * panel mic (mic 2) |
| 11799 | */ |
| 11800 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11801 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11802 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11803 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11804 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11805 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11806 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11807 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11808 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11809 | /* |
| 11810 | * Set up output mixers (0x0c - 0x0e) |
| 11811 | */ |
| 11812 | /* set vol=0 to output mixers */ |
| 11813 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11814 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11815 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11816 | |
| 11817 | /* set up input amps for analog loopback */ |
| 11818 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11819 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11820 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11821 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11822 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11823 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11824 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11825 | |
| 11826 | |
| 11827 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 11828 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 11829 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 11830 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 11831 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11832 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 11833 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 11834 | |
| 11835 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11836 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11837 | |
| 11838 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11839 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11840 | |
| 11841 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 11842 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11843 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11844 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 11845 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11846 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11847 | |
| 11848 | /* FIXME: use matrix-type input source selection */ |
| 11849 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11850 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11851 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 11852 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 11853 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 11854 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 11855 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 11856 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11857 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 11858 | /* Input mixer2 */ |
| 11859 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11860 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11861 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11862 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11863 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11864 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11865 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11866 | /* Input mixer3 */ |
| 11867 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11868 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11869 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11870 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11871 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11872 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11873 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11874 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11875 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11876 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11877 | { } |
| 11878 | }; |
| 11879 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11880 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11881 | |
| 11882 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 11883 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11884 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11885 | |
| 11886 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 11887 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11888 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11889 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11890 | |
| 11891 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11892 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11893 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11894 | {} |
| 11895 | }; |
| 11896 | |
| 11897 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11898 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11899 | #define alc262_loopbacks alc880_loopbacks |
| 11900 | #endif |
| 11901 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11902 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11903 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11904 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11905 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11906 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11907 | |
| 11908 | /* |
| 11909 | * BIOS auto configuration |
| 11910 | */ |
| 11911 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11912 | { |
| 11913 | struct alc_spec *spec = codec->spec; |
| 11914 | int err; |
| 11915 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11916 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11917 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11918 | alc262_ignore); |
| 11919 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11920 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11921 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11922 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11923 | spec->multiout.max_channels = 2; |
| 11924 | spec->no_analog = 1; |
| 11925 | goto dig_only; |
| 11926 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11927 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11928 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11929 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11930 | if (err < 0) |
| 11931 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11932 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11933 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11934 | return err; |
| 11935 | |
| 11936 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11937 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11938 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11939 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11940 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11941 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11942 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11943 | if (spec->autocfg.dig_in_pin) |
| 11944 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11945 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11946 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11947 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11948 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11949 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11950 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11951 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11952 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11953 | err = alc_auto_add_mic_boost(codec); |
| 11954 | if (err < 0) |
| 11955 | return err; |
| 11956 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 11957 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11958 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11959 | return 1; |
| 11960 | } |
| 11961 | |
| 11962 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11963 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11964 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11965 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11966 | |
| 11967 | |
| 11968 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11969 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11970 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11971 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11972 | alc262_auto_init_multi_out(codec); |
| 11973 | alc262_auto_init_hp_out(codec); |
| 11974 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11975 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11976 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11977 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11978 | } |
| 11979 | |
| 11980 | /* |
| 11981 | * configuration and preset |
| 11982 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11983 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11984 | [ALC262_BASIC] = "basic", |
| 11985 | [ALC262_HIPPO] = "hippo", |
| 11986 | [ALC262_HIPPO_1] = "hippo_1", |
| 11987 | [ALC262_FUJITSU] = "fujitsu", |
| 11988 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11989 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11990 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11991 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11992 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11993 | [ALC262_BENQ_T31] = "benq-t31", |
| 11994 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11995 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11996 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11997 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11998 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11999 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12000 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12001 | [ALC262_AUTO] = "auto", |
| 12002 | }; |
| 12003 | |
| 12004 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12005 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12006 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12007 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12008 | ALC262_HP_BPC), |
| 12009 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12010 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12011 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12012 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12013 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12014 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12015 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12016 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12017 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12018 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12019 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12020 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12021 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12022 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12023 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12024 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12025 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12026 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12027 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12028 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12029 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12030 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12031 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12032 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12033 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12034 | #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] | 12035 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12036 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12037 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12038 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12039 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12040 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12041 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12042 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12043 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12044 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12045 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12046 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12047 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12048 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12049 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12050 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12051 | {} |
| 12052 | }; |
| 12053 | |
| 12054 | static struct alc_config_preset alc262_presets[] = { |
| 12055 | [ALC262_BASIC] = { |
| 12056 | .mixers = { alc262_base_mixer }, |
| 12057 | .init_verbs = { alc262_init_verbs }, |
| 12058 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12059 | .dac_nids = alc262_dac_nids, |
| 12060 | .hp_nid = 0x03, |
| 12061 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12062 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12063 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12064 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12065 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12066 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12067 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12068 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12069 | .dac_nids = alc262_dac_nids, |
| 12070 | .hp_nid = 0x03, |
| 12071 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12072 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12073 | .channel_mode = alc262_modes, |
| 12074 | .input_mux = &alc262_capture_source, |
| 12075 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12076 | .setup = alc262_hippo_setup, |
| 12077 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12078 | }, |
| 12079 | [ALC262_HIPPO_1] = { |
| 12080 | .mixers = { alc262_hippo1_mixer }, |
| 12081 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12082 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12083 | .dac_nids = alc262_dac_nids, |
| 12084 | .hp_nid = 0x02, |
| 12085 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12086 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12087 | .channel_mode = alc262_modes, |
| 12088 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12089 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12090 | .setup = alc262_hippo1_setup, |
| 12091 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12092 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12093 | [ALC262_FUJITSU] = { |
| 12094 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12095 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12096 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12097 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12098 | .dac_nids = alc262_dac_nids, |
| 12099 | .hp_nid = 0x03, |
| 12100 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12101 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12102 | .channel_mode = alc262_modes, |
| 12103 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12104 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12105 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12106 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12107 | [ALC262_HP_BPC] = { |
| 12108 | .mixers = { alc262_HP_BPC_mixer }, |
| 12109 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12110 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12111 | .dac_nids = alc262_dac_nids, |
| 12112 | .hp_nid = 0x03, |
| 12113 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12114 | .channel_mode = alc262_modes, |
| 12115 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12116 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12117 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12118 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12119 | [ALC262_HP_BPC_D7000_WF] = { |
| 12120 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12121 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12122 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12123 | .dac_nids = alc262_dac_nids, |
| 12124 | .hp_nid = 0x03, |
| 12125 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12126 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12127 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12128 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12129 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12130 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12131 | [ALC262_HP_BPC_D7000_WL] = { |
| 12132 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12133 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12134 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12135 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12136 | .dac_nids = alc262_dac_nids, |
| 12137 | .hp_nid = 0x03, |
| 12138 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12139 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12140 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12141 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12142 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12143 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12144 | [ALC262_HP_TC_T5735] = { |
| 12145 | .mixers = { alc262_hp_t5735_mixer }, |
| 12146 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12147 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12148 | .dac_nids = alc262_dac_nids, |
| 12149 | .hp_nid = 0x03, |
| 12150 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12151 | .channel_mode = alc262_modes, |
| 12152 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12153 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12154 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12155 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12156 | }, |
| 12157 | [ALC262_HP_RP5700] = { |
| 12158 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12159 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12160 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12161 | .dac_nids = alc262_dac_nids, |
| 12162 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12163 | .channel_mode = alc262_modes, |
| 12164 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12165 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12166 | [ALC262_BENQ_ED8] = { |
| 12167 | .mixers = { alc262_base_mixer }, |
| 12168 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12169 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12170 | .dac_nids = alc262_dac_nids, |
| 12171 | .hp_nid = 0x03, |
| 12172 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12173 | .channel_mode = alc262_modes, |
| 12174 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12175 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12176 | [ALC262_SONY_ASSAMD] = { |
| 12177 | .mixers = { alc262_sony_mixer }, |
| 12178 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12179 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12180 | .dac_nids = alc262_dac_nids, |
| 12181 | .hp_nid = 0x02, |
| 12182 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12183 | .channel_mode = alc262_modes, |
| 12184 | .input_mux = &alc262_capture_source, |
| 12185 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12186 | .setup = alc262_hippo_setup, |
| 12187 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12188 | }, |
| 12189 | [ALC262_BENQ_T31] = { |
| 12190 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12191 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12192 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12193 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12194 | .dac_nids = alc262_dac_nids, |
| 12195 | .hp_nid = 0x03, |
| 12196 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12197 | .channel_mode = alc262_modes, |
| 12198 | .input_mux = &alc262_capture_source, |
| 12199 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12200 | .setup = alc262_hippo_setup, |
| 12201 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12202 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12203 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12204 | .mixers = { alc262_ultra_mixer }, |
| 12205 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12206 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12207 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12208 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12209 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12210 | .channel_mode = alc262_modes, |
| 12211 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12212 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12213 | .capsrc_nids = alc262_capsrc_nids, |
| 12214 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12215 | .unsol_event = alc262_ultra_unsol_event, |
| 12216 | .init_hook = alc262_ultra_automute, |
| 12217 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12218 | [ALC262_LENOVO_3000] = { |
| 12219 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12220 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12221 | alc262_lenovo_3000_unsol_verbs, |
| 12222 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12223 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12224 | .dac_nids = alc262_dac_nids, |
| 12225 | .hp_nid = 0x03, |
| 12226 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12227 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12228 | .channel_mode = alc262_modes, |
| 12229 | .input_mux = &alc262_fujitsu_capture_source, |
| 12230 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12231 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12232 | [ALC262_NEC] = { |
| 12233 | .mixers = { alc262_nec_mixer }, |
| 12234 | .init_verbs = { alc262_nec_verbs }, |
| 12235 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12236 | .dac_nids = alc262_dac_nids, |
| 12237 | .hp_nid = 0x03, |
| 12238 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12239 | .channel_mode = alc262_modes, |
| 12240 | .input_mux = &alc262_capture_source, |
| 12241 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12242 | [ALC262_TOSHIBA_S06] = { |
| 12243 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12244 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12245 | alc262_eapd_verbs }, |
| 12246 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12247 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12248 | .dac_nids = alc262_dac_nids, |
| 12249 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12250 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12251 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12252 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12253 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12254 | .unsol_event = alc_sku_unsol_event, |
| 12255 | .setup = alc262_toshiba_s06_setup, |
| 12256 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12257 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12258 | [ALC262_TOSHIBA_RX1] = { |
| 12259 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12260 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12261 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12262 | .dac_nids = alc262_dac_nids, |
| 12263 | .hp_nid = 0x03, |
| 12264 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12265 | .channel_mode = alc262_modes, |
| 12266 | .input_mux = &alc262_capture_source, |
| 12267 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12268 | .setup = alc262_hippo_setup, |
| 12269 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12270 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12271 | [ALC262_TYAN] = { |
| 12272 | .mixers = { alc262_tyan_mixer }, |
| 12273 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12274 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12275 | .dac_nids = alc262_dac_nids, |
| 12276 | .hp_nid = 0x02, |
| 12277 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12278 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12279 | .channel_mode = alc262_modes, |
| 12280 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12281 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12282 | .setup = alc262_tyan_setup, |
| 12283 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12284 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12285 | }; |
| 12286 | |
| 12287 | static int patch_alc262(struct hda_codec *codec) |
| 12288 | { |
| 12289 | struct alc_spec *spec; |
| 12290 | int board_config; |
| 12291 | int err; |
| 12292 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12293 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12294 | if (spec == NULL) |
| 12295 | return -ENOMEM; |
| 12296 | |
| 12297 | codec->spec = spec; |
| 12298 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12299 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12300 | * under-run |
| 12301 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12302 | { |
| 12303 | int tmp; |
| 12304 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12305 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12306 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12307 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12308 | } |
| 12309 | #endif |
| 12310 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12311 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12312 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12313 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12314 | alc262_models, |
| 12315 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12316 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12317 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12318 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12319 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12320 | board_config = ALC262_AUTO; |
| 12321 | } |
| 12322 | |
| 12323 | if (board_config == ALC262_AUTO) { |
| 12324 | /* automatic parse from the BIOS config */ |
| 12325 | err = alc262_parse_auto_config(codec); |
| 12326 | if (err < 0) { |
| 12327 | alc_free(codec); |
| 12328 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12329 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12330 | printk(KERN_INFO |
| 12331 | "hda_codec: Cannot set up configuration " |
| 12332 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12333 | board_config = ALC262_BASIC; |
| 12334 | } |
| 12335 | } |
| 12336 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12337 | if (!spec->no_analog) { |
| 12338 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12339 | if (err < 0) { |
| 12340 | alc_free(codec); |
| 12341 | return err; |
| 12342 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12343 | } |
| 12344 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12345 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12346 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12347 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12348 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12349 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12350 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12351 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12352 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12353 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12354 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12355 | int i; |
| 12356 | /* check whether the digital-mic has to be supported */ |
| 12357 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12358 | if (spec->input_mux->items[i].index >= 9) |
| 12359 | break; |
| 12360 | } |
| 12361 | if (i < spec->input_mux->num_items) { |
| 12362 | /* use only ADC0 */ |
| 12363 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12364 | spec->num_adc_nids = 1; |
| 12365 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12366 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12367 | /* all analog inputs */ |
| 12368 | /* check whether NID 0x07 is valid */ |
| 12369 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12370 | |
| 12371 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12372 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12373 | if (wcap != AC_WID_AUD_IN) { |
| 12374 | spec->adc_nids = alc262_adc_nids_alt; |
| 12375 | spec->num_adc_nids = |
| 12376 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12377 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12378 | } else { |
| 12379 | spec->adc_nids = alc262_adc_nids; |
| 12380 | spec->num_adc_nids = |
| 12381 | ARRAY_SIZE(alc262_adc_nids); |
| 12382 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12383 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12384 | } |
| 12385 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12386 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12387 | set_capture_mixer(codec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12388 | if (!spec->no_analog) |
| 12389 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12390 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12391 | spec->vmaster_nid = 0x0c; |
| 12392 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12393 | codec->patch_ops = alc_patch_ops; |
| 12394 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12395 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12396 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12397 | if (!spec->loopback.amplist) |
| 12398 | spec->loopback.amplist = alc262_loopbacks; |
| 12399 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12400 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12401 | return 0; |
| 12402 | } |
| 12403 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12404 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12405 | * ALC268 channel source setting (2 channel) |
| 12406 | */ |
| 12407 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12408 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12409 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12410 | static hda_nid_t alc268_dac_nids[2] = { |
| 12411 | /* front, hp */ |
| 12412 | 0x02, 0x03 |
| 12413 | }; |
| 12414 | |
| 12415 | static hda_nid_t alc268_adc_nids[2] = { |
| 12416 | /* ADC0-1 */ |
| 12417 | 0x08, 0x07 |
| 12418 | }; |
| 12419 | |
| 12420 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 12421 | /* ADC0 */ |
| 12422 | 0x08 |
| 12423 | }; |
| 12424 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12425 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 12426 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12427 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 12428 | /* output mixer control */ |
| 12429 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12430 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12431 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12432 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12433 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12434 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12435 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12436 | { } |
| 12437 | }; |
| 12438 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12439 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 12440 | /* output mixer control */ |
| 12441 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12442 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12443 | ALC262_HIPPO_MASTER_SWITCH, |
| 12444 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12445 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12446 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12447 | { } |
| 12448 | }; |
| 12449 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12450 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 12451 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 12452 | .ops = &snd_hda_bind_sw, |
| 12453 | .values = { |
| 12454 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 12455 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 12456 | 0 |
| 12457 | }, |
| 12458 | }; |
| 12459 | |
| 12460 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 12461 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 12462 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 12463 | { } |
| 12464 | }; |
| 12465 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12466 | static struct hda_verb alc268_eapd_verbs[] = { |
| 12467 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12468 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12469 | { } |
| 12470 | }; |
| 12471 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12472 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12473 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 12474 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12475 | { } /* end */ |
| 12476 | }; |
| 12477 | |
| 12478 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12479 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 12480 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 12481 | .ops = &snd_hda_bind_vol, |
| 12482 | .values = { |
| 12483 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12484 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12485 | 0 |
| 12486 | }, |
| 12487 | }; |
| 12488 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12489 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12490 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 12491 | { |
| 12492 | struct alc_spec *spec = codec->spec; |
| 12493 | unsigned int mute; |
| 12494 | |
| 12495 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12496 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12497 | spec->sense_updated = 1; |
| 12498 | } |
| 12499 | if (spec->jack_present) |
| 12500 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 12501 | else /* unmute internal speaker if necessary */ |
| 12502 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 12503 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12504 | HDA_AMP_MUTE, mute); |
| 12505 | } |
| 12506 | |
| 12507 | |
| 12508 | /* bind hp and internal speaker mute (with plug check) */ |
| 12509 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 12510 | struct snd_ctl_elem_value *ucontrol) |
| 12511 | { |
| 12512 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12513 | long *valp = ucontrol->value.integer.value; |
| 12514 | int change; |
| 12515 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 12516 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12517 | if (change) |
| 12518 | alc268_acer_automute(codec, 0); |
| 12519 | return change; |
| 12520 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12521 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12522 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 12523 | /* output mixer control */ |
| 12524 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12525 | { |
| 12526 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12527 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12528 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12529 | .info = snd_hda_mixer_amp_switch_info, |
| 12530 | .get = snd_hda_mixer_amp_switch_get, |
| 12531 | .put = alc268_acer_master_sw_put, |
| 12532 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12533 | }, |
| 12534 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 12535 | { } |
| 12536 | }; |
| 12537 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12538 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 12539 | /* output mixer control */ |
| 12540 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12541 | { |
| 12542 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12543 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12544 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12545 | .info = snd_hda_mixer_amp_switch_info, |
| 12546 | .get = snd_hda_mixer_amp_switch_get, |
| 12547 | .put = alc268_acer_master_sw_put, |
| 12548 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12549 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12550 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12551 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12552 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12553 | { } |
| 12554 | }; |
| 12555 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12556 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 12557 | /* output mixer control */ |
| 12558 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12559 | { |
| 12560 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12561 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12562 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12563 | .info = snd_hda_mixer_amp_switch_info, |
| 12564 | .get = snd_hda_mixer_amp_switch_get, |
| 12565 | .put = alc268_acer_master_sw_put, |
| 12566 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12567 | }, |
| 12568 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12569 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12570 | { } |
| 12571 | }; |
| 12572 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12573 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 12574 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12575 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12576 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12577 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12578 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 12579 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 12580 | { } |
| 12581 | }; |
| 12582 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12583 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12584 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 12585 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12586 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12587 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12588 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12589 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12590 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12591 | { } |
| 12592 | }; |
| 12593 | |
| 12594 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12595 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12596 | #define alc268_toshiba_setup alc262_hippo_setup |
| 12597 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12598 | |
| 12599 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 12600 | unsigned int res) |
| 12601 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12602 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12603 | return; |
| 12604 | alc268_acer_automute(codec, 1); |
| 12605 | } |
| 12606 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12607 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 12608 | { |
| 12609 | alc268_acer_automute(codec, 1); |
| 12610 | } |
| 12611 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12612 | /* toggle speaker-output according to the hp-jack state */ |
| 12613 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 12614 | { |
| 12615 | unsigned int present; |
| 12616 | unsigned char bits; |
| 12617 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12618 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12619 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12620 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12621 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12622 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12623 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12624 | } |
| 12625 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12626 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 12627 | unsigned int res) |
| 12628 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12629 | switch (res >> 26) { |
| 12630 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12631 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12632 | break; |
| 12633 | case ALC880_MIC_EVENT: |
| 12634 | alc_mic_automute(codec); |
| 12635 | break; |
| 12636 | } |
| 12637 | } |
| 12638 | |
| 12639 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 12640 | { |
| 12641 | struct alc_spec *spec = codec->spec; |
| 12642 | spec->ext_mic.pin = 0x18; |
| 12643 | spec->ext_mic.mux_idx = 0; |
| 12644 | spec->int_mic.pin = 0x12; |
| 12645 | spec->int_mic.mux_idx = 6; |
| 12646 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12647 | } |
| 12648 | |
| 12649 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 12650 | { |
| 12651 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12652 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12653 | } |
| 12654 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12655 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 12656 | /* output mixer control */ |
| 12657 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12658 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12659 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12660 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12661 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12662 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12663 | { } |
| 12664 | }; |
| 12665 | |
| 12666 | static struct hda_verb alc268_dell_verbs[] = { |
| 12667 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12668 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12669 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12670 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12671 | { } |
| 12672 | }; |
| 12673 | |
| 12674 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12675 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12676 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12677 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12678 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12679 | spec->autocfg.hp_pins[0] = 0x15; |
| 12680 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12681 | spec->ext_mic.pin = 0x18; |
| 12682 | spec->ext_mic.mux_idx = 0; |
| 12683 | spec->int_mic.pin = 0x19; |
| 12684 | spec->int_mic.mux_idx = 1; |
| 12685 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12686 | } |
| 12687 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12688 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 12689 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12690 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12691 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12692 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12693 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12694 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12695 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12696 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12697 | { } |
| 12698 | }; |
| 12699 | |
| 12700 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 12701 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12702 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 12703 | { } |
| 12704 | }; |
| 12705 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12706 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12707 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12708 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12709 | spec->autocfg.hp_pins[0] = 0x15; |
| 12710 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12711 | spec->ext_mic.pin = 0x18; |
| 12712 | spec->ext_mic.mux_idx = 0; |
| 12713 | spec->int_mic.pin = 0x19; |
| 12714 | spec->int_mic.mux_idx = 1; |
| 12715 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12716 | } |
| 12717 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12718 | /* |
| 12719 | * generic initialization of ADC, input mixers and output mixers |
| 12720 | */ |
| 12721 | static struct hda_verb alc268_base_init_verbs[] = { |
| 12722 | /* Unmute DAC0-1 and set vol = 0 */ |
| 12723 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12724 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12725 | |
| 12726 | /* |
| 12727 | * Set up output mixers (0x0c - 0x0e) |
| 12728 | */ |
| 12729 | /* set vol=0 to output mixers */ |
| 12730 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12731 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12732 | |
| 12733 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12734 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12735 | |
| 12736 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12737 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12738 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12739 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12740 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12741 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12742 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12743 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12744 | |
| 12745 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12746 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12747 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12748 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12749 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12750 | |
| 12751 | /* set PCBEEP vol = 0, mute connections */ |
| 12752 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12753 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12754 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12755 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12756 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12757 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12758 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12759 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12760 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12761 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12762 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12763 | { } |
| 12764 | }; |
| 12765 | |
| 12766 | /* |
| 12767 | * generic initialization of ADC, input mixers and output mixers |
| 12768 | */ |
| 12769 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12770 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12771 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12772 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12773 | |
| 12774 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12775 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12776 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12777 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12778 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12779 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12780 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12781 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12782 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12783 | |
| 12784 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12785 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12786 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12787 | /* set PCBEEP vol = 0, mute connections */ |
| 12788 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12789 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12790 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12791 | |
| 12792 | { } |
| 12793 | }; |
| 12794 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12795 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 12796 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12797 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12798 | { } /* end */ |
| 12799 | }; |
| 12800 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12801 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 12802 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12803 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12804 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12805 | { } /* end */ |
| 12806 | }; |
| 12807 | |
| 12808 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 12809 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12810 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12811 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12812 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12813 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12814 | { } /* end */ |
| 12815 | }; |
| 12816 | |
| 12817 | static struct hda_input_mux alc268_capture_source = { |
| 12818 | .num_items = 4, |
| 12819 | .items = { |
| 12820 | { "Mic", 0x0 }, |
| 12821 | { "Front Mic", 0x1 }, |
| 12822 | { "Line", 0x2 }, |
| 12823 | { "CD", 0x3 }, |
| 12824 | }, |
| 12825 | }; |
| 12826 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12827 | static struct hda_input_mux alc268_acer_capture_source = { |
| 12828 | .num_items = 3, |
| 12829 | .items = { |
| 12830 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12831 | { "Internal Mic", 0x1 }, |
| 12832 | { "Line", 0x2 }, |
| 12833 | }, |
| 12834 | }; |
| 12835 | |
| 12836 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 12837 | .num_items = 3, |
| 12838 | .items = { |
| 12839 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12840 | { "Internal Mic", 0x6 }, |
| 12841 | { "Line", 0x2 }, |
| 12842 | }, |
| 12843 | }; |
| 12844 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12845 | #ifdef CONFIG_SND_DEBUG |
| 12846 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12847 | /* Volume widgets */ |
| 12848 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12849 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12850 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12851 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12852 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12853 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12854 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12855 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12856 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12857 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12858 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12859 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12860 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12861 | /* The below appears problematic on some hardwares */ |
| 12862 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12863 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12864 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12865 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12866 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12867 | |
| 12868 | /* Modes for retasking pin widgets */ |
| 12869 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12870 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12871 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12872 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12873 | |
| 12874 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12875 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12876 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12877 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12878 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12879 | |
| 12880 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12881 | * The ALC268 does not have an SPDIF input. |
| 12882 | */ |
| 12883 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12884 | |
| 12885 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12886 | * this output to turn on an external amplifier. |
| 12887 | */ |
| 12888 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12889 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12890 | |
| 12891 | { } /* end */ |
| 12892 | }; |
| 12893 | #endif |
| 12894 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12895 | /* create input playback/capture controls for the given pin */ |
| 12896 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12897 | const char *ctlname, int idx) |
| 12898 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12899 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12900 | int err; |
| 12901 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12902 | switch (nid) { |
| 12903 | case 0x14: |
| 12904 | case 0x16: |
| 12905 | dac = 0x02; |
| 12906 | break; |
| 12907 | case 0x15: |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 12908 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12909 | dac = 0x03; |
| 12910 | break; |
| 12911 | default: |
| 12912 | return 0; |
| 12913 | } |
| 12914 | if (spec->multiout.dac_nids[0] != dac && |
| 12915 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12916 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12917 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12918 | HDA_OUTPUT)); |
| 12919 | if (err < 0) |
| 12920 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12921 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 12922 | } |
| 12923 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12924 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12925 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12926 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12927 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12928 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12929 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12930 | if (err < 0) |
| 12931 | return err; |
| 12932 | return 0; |
| 12933 | } |
| 12934 | |
| 12935 | /* add playback controls from the parsed DAC table */ |
| 12936 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12937 | const struct auto_pin_cfg *cfg) |
| 12938 | { |
| 12939 | hda_nid_t nid; |
| 12940 | int err; |
| 12941 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12942 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12943 | |
| 12944 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12945 | if (nid) { |
| 12946 | const char *name; |
| 12947 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 12948 | name = "Speaker"; |
| 12949 | else |
| 12950 | name = "Front"; |
| 12951 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 12952 | if (err < 0) |
| 12953 | return err; |
| 12954 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12955 | |
| 12956 | nid = cfg->speaker_pins[0]; |
| 12957 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12958 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12959 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12960 | if (err < 0) |
| 12961 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12962 | } else { |
| 12963 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 12964 | if (err < 0) |
| 12965 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12966 | } |
| 12967 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12968 | if (nid) { |
| 12969 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12970 | if (err < 0) |
| 12971 | return err; |
| 12972 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12973 | |
| 12974 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12975 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12976 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12977 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12978 | if (err < 0) |
| 12979 | return err; |
| 12980 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12981 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12982 | } |
| 12983 | |
| 12984 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12985 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12986 | const struct auto_pin_cfg *cfg) |
| 12987 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12988 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12989 | } |
| 12990 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12991 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12992 | hda_nid_t nid, int pin_type) |
| 12993 | { |
| 12994 | int idx; |
| 12995 | |
| 12996 | alc_set_pin_output(codec, nid, pin_type); |
| 12997 | if (nid == 0x14 || nid == 0x16) |
| 12998 | idx = 0; |
| 12999 | else |
| 13000 | idx = 1; |
| 13001 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13002 | } |
| 13003 | |
| 13004 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13005 | { |
| 13006 | struct alc_spec *spec = codec->spec; |
| 13007 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 13008 | if (nid) { |
| 13009 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13010 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13011 | } |
| 13012 | } |
| 13013 | |
| 13014 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13015 | { |
| 13016 | struct alc_spec *spec = codec->spec; |
| 13017 | hda_nid_t pin; |
| 13018 | |
| 13019 | pin = spec->autocfg.hp_pins[0]; |
| 13020 | if (pin) |
| 13021 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 13022 | pin = spec->autocfg.speaker_pins[0]; |
| 13023 | if (pin) |
| 13024 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 13025 | } |
| 13026 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13027 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13028 | { |
| 13029 | struct alc_spec *spec = codec->spec; |
| 13030 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13031 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13032 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13033 | unsigned int dac_vol1, dac_vol2; |
| 13034 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13035 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13036 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13037 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13038 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13039 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13040 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13041 | AMP_IN_UNMUTE(1)); |
| 13042 | snd_hda_codec_write(codec, 0x10, 0, |
| 13043 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13044 | AMP_IN_UNMUTE(1)); |
| 13045 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13046 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13047 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13048 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13049 | snd_hda_codec_write(codec, 0x10, 0, |
| 13050 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13051 | } |
| 13052 | |
| 13053 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13054 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13055 | dac_vol2 = AMP_OUT_ZERO; |
| 13056 | else if (line_nid == 0x15) |
| 13057 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13058 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13059 | dac_vol2 = AMP_OUT_ZERO; |
| 13060 | else if (hp_nid == 0x15) |
| 13061 | dac_vol1 = AMP_OUT_ZERO; |
| 13062 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13063 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13064 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13065 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13066 | |
| 13067 | snd_hda_codec_write(codec, 0x02, 0, |
| 13068 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13069 | snd_hda_codec_write(codec, 0x03, 0, |
| 13070 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13071 | } |
| 13072 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13073 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13074 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13075 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13076 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13077 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13078 | |
| 13079 | /* |
| 13080 | * BIOS auto configuration |
| 13081 | */ |
| 13082 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13083 | { |
| 13084 | struct alc_spec *spec = codec->spec; |
| 13085 | int err; |
| 13086 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13087 | |
| 13088 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13089 | alc268_ignore); |
| 13090 | if (err < 0) |
| 13091 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13092 | if (!spec->autocfg.line_outs) { |
| 13093 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13094 | spec->multiout.max_channels = 2; |
| 13095 | spec->no_analog = 1; |
| 13096 | goto dig_only; |
| 13097 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13098 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13099 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13100 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13101 | if (err < 0) |
| 13102 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13103 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13104 | if (err < 0) |
| 13105 | return err; |
| 13106 | |
| 13107 | spec->multiout.max_channels = 2; |
| 13108 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13109 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13110 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13111 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13112 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13113 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 13114 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13115 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13116 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13117 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13118 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13119 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13120 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13121 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13122 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13123 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13124 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13125 | err = alc_auto_add_mic_boost(codec); |
| 13126 | if (err < 0) |
| 13127 | return err; |
| 13128 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13129 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13130 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13131 | return 1; |
| 13132 | } |
| 13133 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13134 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13135 | |
| 13136 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13137 | static void alc268_auto_init(struct hda_codec *codec) |
| 13138 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13139 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13140 | alc268_auto_init_multi_out(codec); |
| 13141 | alc268_auto_init_hp_out(codec); |
| 13142 | alc268_auto_init_mono_speaker_out(codec); |
| 13143 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13144 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13145 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13146 | } |
| 13147 | |
| 13148 | /* |
| 13149 | * configuration and preset |
| 13150 | */ |
| 13151 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13152 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13153 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13154 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13155 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13156 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13157 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13158 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13159 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13160 | #ifdef CONFIG_SND_DEBUG |
| 13161 | [ALC268_TEST] = "test", |
| 13162 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13163 | [ALC268_AUTO] = "auto", |
| 13164 | }; |
| 13165 | |
| 13166 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13167 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13168 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13169 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13170 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13171 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13172 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13173 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13174 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13175 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13176 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13177 | /* almost compatible with toshiba but with optional digital outs; |
| 13178 | * auto-probing seems working fine |
| 13179 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13180 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13181 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13182 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13183 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13184 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13185 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13186 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13187 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13188 | {} |
| 13189 | }; |
| 13190 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13191 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13192 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13193 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13194 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13195 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13196 | ALC268_TOSHIBA), |
| 13197 | {} |
| 13198 | }; |
| 13199 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13200 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13201 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13202 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13203 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13204 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13205 | alc267_quanta_il1_verbs }, |
| 13206 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13207 | .dac_nids = alc268_dac_nids, |
| 13208 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13209 | .adc_nids = alc268_adc_nids_alt, |
| 13210 | .hp_nid = 0x03, |
| 13211 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13212 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13213 | .unsol_event = alc_sku_unsol_event, |
| 13214 | .setup = alc267_quanta_il1_setup, |
| 13215 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13216 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13217 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13218 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13219 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13220 | .init_verbs = { alc268_base_init_verbs }, |
| 13221 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13222 | .dac_nids = alc268_dac_nids, |
| 13223 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13224 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13225 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13226 | .hp_nid = 0x03, |
| 13227 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13228 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13229 | .channel_mode = alc268_modes, |
| 13230 | .input_mux = &alc268_capture_source, |
| 13231 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13232 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13233 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13234 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13235 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13236 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13237 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13238 | .dac_nids = alc268_dac_nids, |
| 13239 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13240 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13241 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13242 | .hp_nid = 0x03, |
| 13243 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13244 | .channel_mode = alc268_modes, |
| 13245 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13246 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13247 | .setup = alc268_toshiba_setup, |
| 13248 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13249 | }, |
| 13250 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13251 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13252 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13253 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13254 | alc268_acer_verbs }, |
| 13255 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13256 | .dac_nids = alc268_dac_nids, |
| 13257 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13258 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13259 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13260 | .hp_nid = 0x02, |
| 13261 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13262 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13263 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13264 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13265 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13266 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13267 | [ALC268_ACER_DMIC] = { |
| 13268 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13269 | alc268_beep_mixer }, |
| 13270 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13271 | alc268_acer_verbs }, |
| 13272 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13273 | .dac_nids = alc268_dac_nids, |
| 13274 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13275 | .adc_nids = alc268_adc_nids_alt, |
| 13276 | .capsrc_nids = alc268_capsrc_nids, |
| 13277 | .hp_nid = 0x02, |
| 13278 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13279 | .channel_mode = alc268_modes, |
| 13280 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13281 | .unsol_event = alc268_acer_unsol_event, |
| 13282 | .init_hook = alc268_acer_init_hook, |
| 13283 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13284 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13285 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13286 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13287 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13288 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13289 | alc268_acer_aspire_one_verbs }, |
| 13290 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13291 | .dac_nids = alc268_dac_nids, |
| 13292 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13293 | .adc_nids = alc268_adc_nids_alt, |
| 13294 | .capsrc_nids = alc268_capsrc_nids, |
| 13295 | .hp_nid = 0x03, |
| 13296 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13297 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13298 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13299 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13300 | .init_hook = alc268_acer_lc_init_hook, |
| 13301 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13302 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13303 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13304 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13305 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13306 | alc268_dell_verbs }, |
| 13307 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13308 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13309 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13310 | .adc_nids = alc268_adc_nids_alt, |
| 13311 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13312 | .hp_nid = 0x02, |
| 13313 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13314 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13315 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13316 | .setup = alc268_dell_setup, |
| 13317 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13318 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13319 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13320 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13321 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13322 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13323 | alc268_toshiba_verbs }, |
| 13324 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13325 | .dac_nids = alc268_dac_nids, |
| 13326 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13327 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13328 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13329 | .hp_nid = 0x03, |
| 13330 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13331 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13332 | .channel_mode = alc268_modes, |
| 13333 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13334 | .setup = alc268_toshiba_setup, |
| 13335 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13336 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13337 | #ifdef CONFIG_SND_DEBUG |
| 13338 | [ALC268_TEST] = { |
| 13339 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13340 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13341 | alc268_volume_init_verbs }, |
| 13342 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13343 | .dac_nids = alc268_dac_nids, |
| 13344 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13345 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13346 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13347 | .hp_nid = 0x03, |
| 13348 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13349 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13350 | .channel_mode = alc268_modes, |
| 13351 | .input_mux = &alc268_capture_source, |
| 13352 | }, |
| 13353 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13354 | }; |
| 13355 | |
| 13356 | static int patch_alc268(struct hda_codec *codec) |
| 13357 | { |
| 13358 | struct alc_spec *spec; |
| 13359 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13360 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13361 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13362 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13363 | if (spec == NULL) |
| 13364 | return -ENOMEM; |
| 13365 | |
| 13366 | codec->spec = spec; |
| 13367 | |
| 13368 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13369 | alc268_models, |
| 13370 | alc268_cfg_tbl); |
| 13371 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13372 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13373 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13374 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13375 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13376 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13377 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13378 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13379 | board_config = ALC268_AUTO; |
| 13380 | } |
| 13381 | |
| 13382 | if (board_config == ALC268_AUTO) { |
| 13383 | /* automatic parse from the BIOS config */ |
| 13384 | err = alc268_parse_auto_config(codec); |
| 13385 | if (err < 0) { |
| 13386 | alc_free(codec); |
| 13387 | return err; |
| 13388 | } else if (!err) { |
| 13389 | printk(KERN_INFO |
| 13390 | "hda_codec: Cannot set up configuration " |
| 13391 | "from BIOS. Using base mode...\n"); |
| 13392 | board_config = ALC268_3ST; |
| 13393 | } |
| 13394 | } |
| 13395 | |
| 13396 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13397 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13398 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13399 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 13400 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13401 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13402 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13403 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 13404 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13405 | has_beep = 0; |
| 13406 | for (i = 0; i < spec->num_mixers; i++) { |
| 13407 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 13408 | has_beep = 1; |
| 13409 | break; |
| 13410 | } |
| 13411 | } |
| 13412 | |
| 13413 | if (has_beep) { |
| 13414 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13415 | if (err < 0) { |
| 13416 | alc_free(codec); |
| 13417 | return err; |
| 13418 | } |
| 13419 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 13420 | /* override the amp caps for beep generator */ |
| 13421 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13422 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 13423 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 13424 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 13425 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13426 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13427 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13428 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13429 | /* check whether NID 0x07 is valid */ |
| 13430 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13431 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13432 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13433 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13434 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13435 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13436 | if (spec->auto_mic || |
| 13437 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13438 | spec->adc_nids = alc268_adc_nids_alt; |
| 13439 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13440 | if (spec->auto_mic) |
| 13441 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13442 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 13443 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 13444 | else |
| 13445 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13446 | } else { |
| 13447 | spec->adc_nids = alc268_adc_nids; |
| 13448 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13449 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13450 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13451 | /* set default input source */ |
| 13452 | for (i = 0; i < spec->num_adc_nids; i++) |
| 13453 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 13454 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13455 | i < spec->num_mux_defs ? |
| 13456 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13457 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13458 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13459 | |
| 13460 | spec->vmaster_nid = 0x02; |
| 13461 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13462 | codec->patch_ops = alc_patch_ops; |
| 13463 | if (board_config == ALC268_AUTO) |
| 13464 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13465 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13466 | return 0; |
| 13467 | } |
| 13468 | |
| 13469 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13470 | * ALC269 channel source setting (2 channel) |
| 13471 | */ |
| 13472 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 13473 | |
| 13474 | #define alc269_dac_nids alc260_dac_nids |
| 13475 | |
| 13476 | static hda_nid_t alc269_adc_nids[1] = { |
| 13477 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13478 | 0x08, |
| 13479 | }; |
| 13480 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13481 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 13482 | 0x23, |
| 13483 | }; |
| 13484 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13485 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 13486 | /* ADC1 */ |
| 13487 | 0x09, |
| 13488 | }; |
| 13489 | |
| 13490 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 13491 | 0x22, |
| 13492 | }; |
| 13493 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 13494 | static hda_nid_t alc269_adc_candidates[] = { |
| 13495 | 0x08, 0x09, 0x07, |
| 13496 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13497 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13498 | #define alc269_modes alc260_modes |
| 13499 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 13500 | |
| 13501 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 13502 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13503 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13504 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13505 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13506 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13507 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13508 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13509 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13510 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13511 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13512 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13513 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 13514 | { } /* end */ |
| 13515 | }; |
| 13516 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13517 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 13518 | /* output mixer control */ |
| 13519 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13520 | { |
| 13521 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13522 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13523 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13524 | .info = snd_hda_mixer_amp_switch_info, |
| 13525 | .get = snd_hda_mixer_amp_switch_get, |
| 13526 | .put = alc268_acer_master_sw_put, |
| 13527 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13528 | }, |
| 13529 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13530 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13531 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13532 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13533 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13534 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13535 | { } |
| 13536 | }; |
| 13537 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13538 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 13539 | /* output mixer control */ |
| 13540 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13541 | { |
| 13542 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13543 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13544 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13545 | .info = snd_hda_mixer_amp_switch_info, |
| 13546 | .get = snd_hda_mixer_amp_switch_get, |
| 13547 | .put = alc268_acer_master_sw_put, |
| 13548 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13549 | }, |
| 13550 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13551 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13552 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13553 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13554 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13555 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13556 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 13557 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 13558 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13559 | { } |
| 13560 | }; |
| 13561 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13562 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13563 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13564 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13565 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13566 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13567 | { } /* end */ |
| 13568 | }; |
| 13569 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13570 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 13571 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13572 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13573 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13574 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13575 | { } /* end */ |
| 13576 | }; |
| 13577 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13578 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13579 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 13580 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13581 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 13582 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13583 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13584 | { } /* end */ |
| 13585 | }; |
| 13586 | |
| 13587 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13588 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13589 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13590 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13591 | { } /* end */ |
| 13592 | }; |
| 13593 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13594 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 13595 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13596 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13597 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13598 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13599 | { } /* end */ |
| 13600 | }; |
| 13601 | |
| 13602 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 13603 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13604 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13605 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13606 | { } /* end */ |
| 13607 | }; |
| 13608 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13609 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13610 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13611 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13612 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 13613 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13614 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13615 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13616 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13617 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13618 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13619 | { } |
| 13620 | }; |
| 13621 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13622 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 13623 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13624 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13625 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13626 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13627 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13628 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13629 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13630 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13631 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13632 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13633 | { } |
| 13634 | }; |
| 13635 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13636 | /* toggle speaker-output according to the hp-jack state */ |
| 13637 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 13638 | { |
| 13639 | unsigned int present; |
| 13640 | unsigned char bits; |
| 13641 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13642 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13643 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13644 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13645 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13646 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13647 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13648 | |
| 13649 | snd_hda_codec_write(codec, 0x20, 0, |
| 13650 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13651 | snd_hda_codec_write(codec, 0x20, 0, |
| 13652 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13653 | |
| 13654 | snd_hda_codec_write(codec, 0x20, 0, |
| 13655 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13656 | snd_hda_codec_write(codec, 0x20, 0, |
| 13657 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13658 | } |
| 13659 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13660 | /* toggle speaker-output according to the hp-jacks state */ |
| 13661 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 13662 | { |
| 13663 | unsigned int present; |
| 13664 | unsigned char bits; |
| 13665 | |
| 13666 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13667 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13668 | |
| 13669 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13670 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13671 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13672 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13673 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13674 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13675 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13676 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13677 | |
| 13678 | snd_hda_codec_write(codec, 0x20, 0, |
| 13679 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13680 | snd_hda_codec_write(codec, 0x20, 0, |
| 13681 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13682 | |
| 13683 | snd_hda_codec_write(codec, 0x20, 0, |
| 13684 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13685 | snd_hda_codec_write(codec, 0x20, 0, |
| 13686 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13687 | } |
| 13688 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13689 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 13690 | { |
| 13691 | unsigned int present_laptop; |
| 13692 | unsigned int present_dock; |
| 13693 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13694 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 13695 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13696 | |
| 13697 | /* Laptop mic port overrides dock mic port, design decision */ |
| 13698 | if (present_dock) |
| 13699 | snd_hda_codec_write(codec, 0x23, 0, |
| 13700 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 13701 | if (present_laptop) |
| 13702 | snd_hda_codec_write(codec, 0x23, 0, |
| 13703 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 13704 | if (!present_dock && !present_laptop) |
| 13705 | snd_hda_codec_write(codec, 0x23, 0, |
| 13706 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 13707 | } |
| 13708 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13709 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 13710 | unsigned int res) |
| 13711 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13712 | switch (res >> 26) { |
| 13713 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13714 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13715 | break; |
| 13716 | case ALC880_MIC_EVENT: |
| 13717 | alc_mic_automute(codec); |
| 13718 | break; |
| 13719 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13720 | } |
| 13721 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13722 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 13723 | unsigned int res) |
| 13724 | { |
| 13725 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13726 | alc269_lifebook_speaker_automute(codec); |
| 13727 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13728 | alc269_lifebook_mic_autoswitch(codec); |
| 13729 | } |
| 13730 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13731 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 13732 | { |
| 13733 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 13734 | spec->autocfg.hp_pins[0] = 0x15; |
| 13735 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13736 | spec->ext_mic.pin = 0x18; |
| 13737 | spec->ext_mic.mux_idx = 0; |
| 13738 | spec->int_mic.pin = 0x19; |
| 13739 | spec->int_mic.mux_idx = 1; |
| 13740 | spec->auto_mic = 1; |
| 13741 | } |
| 13742 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13743 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 13744 | { |
| 13745 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13746 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13747 | } |
| 13748 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13749 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 13750 | { |
| 13751 | alc269_lifebook_speaker_automute(codec); |
| 13752 | alc269_lifebook_mic_autoswitch(codec); |
| 13753 | } |
| 13754 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13755 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13756 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13757 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 13758 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13759 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13760 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13761 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13762 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13763 | {} |
| 13764 | }; |
| 13765 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13766 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13767 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13768 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13769 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13770 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13771 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13772 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13773 | {} |
| 13774 | }; |
| 13775 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13776 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 13777 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13778 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13779 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13780 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13781 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13782 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13783 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13784 | {} |
| 13785 | }; |
| 13786 | |
| 13787 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 13788 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13789 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13790 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13791 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13792 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13793 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13794 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13795 | {} |
| 13796 | }; |
| 13797 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13798 | /* toggle speaker-output according to the hp-jack state */ |
| 13799 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 13800 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13801 | struct alc_spec *spec = codec->spec; |
| 13802 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13803 | unsigned int present; |
| 13804 | unsigned char bits; |
| 13805 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13806 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13807 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13808 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13809 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13810 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13811 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13812 | } |
| 13813 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13814 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13815 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13816 | unsigned int res) |
| 13817 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13818 | switch (res >> 26) { |
| 13819 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13820 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13821 | break; |
| 13822 | case ALC880_MIC_EVENT: |
| 13823 | alc_mic_automute(codec); |
| 13824 | break; |
| 13825 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13826 | } |
| 13827 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 13828 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 13829 | { |
| 13830 | struct alc_spec *spec = codec->spec; |
| 13831 | spec->autocfg.hp_pins[0] = 0x15; |
| 13832 | spec->autocfg.speaker_pins[0] = 0x14; |
| 13833 | spec->ext_mic.pin = 0x18; |
| 13834 | spec->ext_mic.mux_idx = 0; |
| 13835 | spec->int_mic.pin = 0x19; |
| 13836 | spec->int_mic.mux_idx = 1; |
| 13837 | spec->auto_mic = 1; |
| 13838 | } |
| 13839 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13840 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13841 | { |
| 13842 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 13843 | spec->autocfg.hp_pins[0] = 0x15; |
| 13844 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13845 | spec->ext_mic.pin = 0x18; |
| 13846 | spec->ext_mic.mux_idx = 0; |
| 13847 | spec->int_mic.pin = 0x12; |
| 13848 | spec->int_mic.mux_idx = 5; |
| 13849 | spec->auto_mic = 1; |
| 13850 | } |
| 13851 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 13852 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13853 | { |
| 13854 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 13855 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 13856 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13857 | spec->ext_mic.pin = 0x18; |
| 13858 | spec->ext_mic.mux_idx = 0; |
| 13859 | spec->int_mic.pin = 0x19; |
| 13860 | spec->int_mic.mux_idx = 1; |
| 13861 | spec->auto_mic = 1; |
| 13862 | } |
| 13863 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 13864 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 13865 | { |
| 13866 | struct alc_spec *spec = codec->spec; |
| 13867 | spec->autocfg.hp_pins[0] = 0x21; |
| 13868 | spec->autocfg.speaker_pins[0] = 0x14; |
| 13869 | spec->ext_mic.pin = 0x18; |
| 13870 | spec->ext_mic.mux_idx = 0; |
| 13871 | spec->int_mic.pin = 0x12; |
| 13872 | spec->int_mic.mux_idx = 6; |
| 13873 | spec->auto_mic = 1; |
| 13874 | } |
| 13875 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13876 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13877 | { |
| 13878 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13879 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13880 | } |
| 13881 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13882 | /* |
| 13883 | * generic initialization of ADC, input mixers and output mixers |
| 13884 | */ |
| 13885 | static struct hda_verb alc269_init_verbs[] = { |
| 13886 | /* |
| 13887 | * Unmute ADC0 and set the default input to mic-in |
| 13888 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13889 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13890 | |
| 13891 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13892 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13893 | */ |
| 13894 | /* set vol=0 to output mixers */ |
| 13895 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13896 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13897 | |
| 13898 | /* set up input amps for analog loopback */ |
| 13899 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13900 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13901 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13902 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13903 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13904 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13905 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13906 | |
| 13907 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13908 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13909 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13910 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13911 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13912 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13913 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13914 | |
| 13915 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13916 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13917 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13918 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13919 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13920 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13921 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13922 | |
| 13923 | /* set EAPD */ |
| 13924 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13925 | { } |
| 13926 | }; |
| 13927 | |
| 13928 | static struct hda_verb alc269vb_init_verbs[] = { |
| 13929 | /* |
| 13930 | * Unmute ADC0 and set the default input to mic-in |
| 13931 | */ |
| 13932 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13933 | |
| 13934 | /* |
| 13935 | * Set up output mixers (0x02 - 0x03) |
| 13936 | */ |
| 13937 | /* set vol=0 to output mixers */ |
| 13938 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13939 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13940 | |
| 13941 | /* set up input amps for analog loopback */ |
| 13942 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13943 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13944 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13945 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13946 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13947 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13948 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13949 | |
| 13950 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13951 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13952 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13953 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13954 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13955 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13956 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13957 | |
| 13958 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13959 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13960 | |
| 13961 | /* FIXME: use Mux-type input source selection */ |
| 13962 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13963 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 13964 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13965 | |
| 13966 | /* set EAPD */ |
| 13967 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13968 | { } |
| 13969 | }; |
| 13970 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 13971 | #define alc269_auto_create_multi_out_ctls \ |
| 13972 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13973 | #define alc269_auto_create_input_ctls \ |
| 13974 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13975 | |
| 13976 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13977 | #define alc269_loopbacks alc880_loopbacks |
| 13978 | #endif |
| 13979 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13980 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13981 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13982 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13983 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13984 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13985 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13986 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13987 | .substreams = 1, |
| 13988 | .channels_min = 2, |
| 13989 | .channels_max = 8, |
| 13990 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13991 | /* NID is set in alc_build_pcms */ |
| 13992 | .ops = { |
| 13993 | .open = alc880_playback_pcm_open, |
| 13994 | .prepare = alc880_playback_pcm_prepare, |
| 13995 | .cleanup = alc880_playback_pcm_cleanup |
| 13996 | }, |
| 13997 | }; |
| 13998 | |
| 13999 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14000 | .substreams = 1, |
| 14001 | .channels_min = 2, |
| 14002 | .channels_max = 2, |
| 14003 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14004 | /* NID is set in alc_build_pcms */ |
| 14005 | }; |
| 14006 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14007 | /* |
| 14008 | * BIOS auto configuration |
| 14009 | */ |
| 14010 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14011 | { |
| 14012 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14013 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14014 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14015 | |
| 14016 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14017 | alc269_ignore); |
| 14018 | if (err < 0) |
| 14019 | return err; |
| 14020 | |
| 14021 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14022 | if (err < 0) |
| 14023 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14024 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14025 | if (err < 0) |
| 14026 | return err; |
| 14027 | |
| 14028 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14029 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14030 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14031 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 14032 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14033 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14034 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14035 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14036 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { |
| 14037 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14038 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14039 | } else { |
| 14040 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14041 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14042 | } |
| 14043 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14044 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14045 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14046 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14047 | sizeof(alc269_adc_candidates)); |
| 14048 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14049 | /* set default input source */ |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14050 | snd_hda_codec_write_cache(codec, spec->capsrc_nids[0], |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14051 | 0, AC_VERB_SET_CONNECT_SEL, |
| 14052 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14053 | |
| 14054 | err = alc_auto_add_mic_boost(codec); |
| 14055 | if (err < 0) |
| 14056 | return err; |
| 14057 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14058 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14059 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14060 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14061 | return 1; |
| 14062 | } |
| 14063 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14064 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14065 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14066 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14067 | |
| 14068 | |
| 14069 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14070 | static void alc269_auto_init(struct hda_codec *codec) |
| 14071 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14072 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14073 | alc269_auto_init_multi_out(codec); |
| 14074 | alc269_auto_init_hp_out(codec); |
| 14075 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14076 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14077 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14078 | } |
| 14079 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame^] | 14080 | enum { |
| 14081 | ALC269_FIXUP_SONY_VAIO, |
| 14082 | }; |
| 14083 | |
| 14084 | const static struct hda_verb alc269_sony_vaio_fixup_verbs[] = { |
| 14085 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14086 | {} |
| 14087 | }; |
| 14088 | |
| 14089 | static const struct alc_fixup alc269_fixups[] = { |
| 14090 | [ALC269_FIXUP_SONY_VAIO] = { |
| 14091 | .verbs = alc269_sony_vaio_fixup_verbs |
| 14092 | }, |
| 14093 | }; |
| 14094 | |
| 14095 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
| 14096 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
| 14097 | {} |
| 14098 | }; |
| 14099 | |
| 14100 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14101 | /* |
| 14102 | * configuration and preset |
| 14103 | */ |
| 14104 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14105 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14106 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14107 | [ALC269_AMIC] = "laptop-amic", |
| 14108 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14109 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14110 | [ALC269_LIFEBOOK] = "lifebook", |
| 14111 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14112 | }; |
| 14113 | |
| 14114 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14115 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14116 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14117 | ALC269_AMIC), |
| 14118 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14119 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14120 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14121 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14122 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14123 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14124 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14125 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14126 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 14127 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 14128 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14129 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14130 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14131 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14132 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14133 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14134 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14135 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14136 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14137 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14138 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14139 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14140 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14141 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14142 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14143 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14144 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14145 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14146 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14147 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14148 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14149 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14150 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14151 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14152 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14153 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14154 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14155 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14156 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14157 | ALC269_DMIC), |
| 14158 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14159 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame^] | 14160 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14161 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14162 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14163 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14164 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14165 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14166 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14167 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14168 | {} |
| 14169 | }; |
| 14170 | |
| 14171 | static struct alc_config_preset alc269_presets[] = { |
| 14172 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14173 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14174 | .init_verbs = { alc269_init_verbs }, |
| 14175 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14176 | .dac_nids = alc269_dac_nids, |
| 14177 | .hp_nid = 0x03, |
| 14178 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14179 | .channel_mode = alc269_modes, |
| 14180 | .input_mux = &alc269_capture_source, |
| 14181 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14182 | [ALC269_QUANTA_FL1] = { |
| 14183 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14184 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14185 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14186 | .dac_nids = alc269_dac_nids, |
| 14187 | .hp_nid = 0x03, |
| 14188 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14189 | .channel_mode = alc269_modes, |
| 14190 | .input_mux = &alc269_capture_source, |
| 14191 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14192 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14193 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14194 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14195 | [ALC269_AMIC] = { |
| 14196 | .mixers = { alc269_laptop_mixer }, |
| 14197 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14198 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14199 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14200 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14201 | .dac_nids = alc269_dac_nids, |
| 14202 | .hp_nid = 0x03, |
| 14203 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14204 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14205 | .unsol_event = alc269_laptop_unsol_event, |
| 14206 | .setup = alc269_laptop_amic_setup, |
| 14207 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14208 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14209 | [ALC269_DMIC] = { |
| 14210 | .mixers = { alc269_laptop_mixer }, |
| 14211 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14212 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14213 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14214 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14215 | .dac_nids = alc269_dac_nids, |
| 14216 | .hp_nid = 0x03, |
| 14217 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14218 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14219 | .unsol_event = alc269_laptop_unsol_event, |
| 14220 | .setup = alc269_laptop_dmic_setup, |
| 14221 | .init_hook = alc269_laptop_inithook, |
| 14222 | }, |
| 14223 | [ALC269VB_AMIC] = { |
| 14224 | .mixers = { alc269vb_laptop_mixer }, |
| 14225 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 14226 | .init_verbs = { alc269vb_init_verbs, |
| 14227 | alc269vb_laptop_amic_init_verbs }, |
| 14228 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14229 | .dac_nids = alc269_dac_nids, |
| 14230 | .hp_nid = 0x03, |
| 14231 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14232 | .channel_mode = alc269_modes, |
| 14233 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14234 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14235 | .init_hook = alc269_laptop_inithook, |
| 14236 | }, |
| 14237 | [ALC269VB_DMIC] = { |
| 14238 | .mixers = { alc269vb_laptop_mixer }, |
| 14239 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14240 | .init_verbs = { alc269vb_init_verbs, |
| 14241 | alc269vb_laptop_dmic_init_verbs }, |
| 14242 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14243 | .dac_nids = alc269_dac_nids, |
| 14244 | .hp_nid = 0x03, |
| 14245 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14246 | .channel_mode = alc269_modes, |
| 14247 | .unsol_event = alc269_laptop_unsol_event, |
| 14248 | .setup = alc269vb_laptop_dmic_setup, |
| 14249 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14250 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14251 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14252 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14253 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14254 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14255 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14256 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14257 | .dac_nids = alc269_dac_nids, |
| 14258 | .hp_nid = 0x03, |
| 14259 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14260 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14261 | .unsol_event = alc269_laptop_unsol_event, |
| 14262 | .setup = alc269_laptop_dmic_setup, |
| 14263 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14264 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14265 | [ALC269_LIFEBOOK] = { |
| 14266 | .mixers = { alc269_lifebook_mixer }, |
| 14267 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 14268 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14269 | .dac_nids = alc269_dac_nids, |
| 14270 | .hp_nid = 0x03, |
| 14271 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14272 | .channel_mode = alc269_modes, |
| 14273 | .input_mux = &alc269_capture_source, |
| 14274 | .unsol_event = alc269_lifebook_unsol_event, |
| 14275 | .init_hook = alc269_lifebook_init_hook, |
| 14276 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14277 | }; |
| 14278 | |
| 14279 | static int patch_alc269(struct hda_codec *codec) |
| 14280 | { |
| 14281 | struct alc_spec *spec; |
| 14282 | int board_config; |
| 14283 | int err; |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14284 | int is_alc269vb = 0; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14285 | |
| 14286 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14287 | if (spec == NULL) |
| 14288 | return -ENOMEM; |
| 14289 | |
| 14290 | codec->spec = spec; |
| 14291 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 14292 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 14293 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14294 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
| 14295 | kfree(codec->chip_name); |
| 14296 | codec->chip_name = kstrdup("ALC259", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 14297 | if (!codec->chip_name) { |
| 14298 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14299 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 14300 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14301 | is_alc269vb = 1; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14302 | } |
| 14303 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14304 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 14305 | alc269_models, |
| 14306 | alc269_cfg_tbl); |
| 14307 | |
| 14308 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14309 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14310 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14311 | board_config = ALC269_AUTO; |
| 14312 | } |
| 14313 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame^] | 14314 | if (board_config == ALC269_AUTO) |
| 14315 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); |
| 14316 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14317 | if (board_config == ALC269_AUTO) { |
| 14318 | /* automatic parse from the BIOS config */ |
| 14319 | err = alc269_parse_auto_config(codec); |
| 14320 | if (err < 0) { |
| 14321 | alc_free(codec); |
| 14322 | return err; |
| 14323 | } else if (!err) { |
| 14324 | printk(KERN_INFO |
| 14325 | "hda_codec: Cannot set up configuration " |
| 14326 | "from BIOS. Using base mode...\n"); |
| 14327 | board_config = ALC269_BASIC; |
| 14328 | } |
| 14329 | } |
| 14330 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14331 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14332 | if (err < 0) { |
| 14333 | alc_free(codec); |
| 14334 | return err; |
| 14335 | } |
| 14336 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14337 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14338 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14339 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14340 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14341 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 14342 | * fix the sample rate of analog I/O to 44.1kHz |
| 14343 | */ |
| 14344 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 14345 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 14346 | } else { |
| 14347 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14348 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 14349 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14350 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 14351 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 14352 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14353 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
| 14354 | if (!is_alc269vb) { |
| 14355 | spec->adc_nids = alc269_adc_nids; |
| 14356 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 14357 | spec->capsrc_nids = alc269_capsrc_nids; |
| 14358 | } else { |
| 14359 | spec->adc_nids = alc269vb_adc_nids; |
| 14360 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 14361 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 14362 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14363 | } |
| 14364 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14365 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14366 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14367 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14368 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame^] | 14369 | if (board_config == ALC269_AUTO) |
| 14370 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); |
| 14371 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 14372 | spec->vmaster_nid = 0x02; |
| 14373 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14374 | codec->patch_ops = alc_patch_ops; |
| 14375 | if (board_config == ALC269_AUTO) |
| 14376 | spec->init_hook = alc269_auto_init; |
| 14377 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14378 | if (!spec->loopback.amplist) |
| 14379 | spec->loopback.amplist = alc269_loopbacks; |
| 14380 | #endif |
| 14381 | |
| 14382 | return 0; |
| 14383 | } |
| 14384 | |
| 14385 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14386 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 14387 | */ |
| 14388 | |
| 14389 | /* |
| 14390 | * set the path ways for 2 channel output |
| 14391 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 14392 | */ |
| 14393 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 14394 | /* set pin widget 1Ah (line in) for input */ |
| 14395 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14396 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14397 | * the vref |
| 14398 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14399 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14400 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14401 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14402 | #if 0 |
| 14403 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14404 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14405 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14406 | { } /* end */ |
| 14407 | }; |
| 14408 | /* |
| 14409 | * 6ch mode |
| 14410 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 14411 | */ |
| 14412 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 14413 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14414 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14415 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14416 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14417 | |
| 14418 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14419 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14420 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14421 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14422 | #if 0 |
| 14423 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14424 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14425 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14426 | { } /* end */ |
| 14427 | }; |
| 14428 | |
| 14429 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 14430 | { 2, alc861_threestack_ch2_init }, |
| 14431 | { 6, alc861_threestack_ch6_init }, |
| 14432 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14433 | /* Set mic1 as input and unmute the mixer */ |
| 14434 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 14435 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14436 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14437 | { } /* end */ |
| 14438 | }; |
| 14439 | /* Set mic1 as output and mute mixer */ |
| 14440 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 14441 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14442 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14443 | { } /* end */ |
| 14444 | }; |
| 14445 | |
| 14446 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 14447 | { 2, alc861_uniwill_m31_ch2_init }, |
| 14448 | { 4, alc861_uniwill_m31_ch4_init }, |
| 14449 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14450 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14451 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 14452 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 14453 | /* set pin widget 1Ah (line in) for input */ |
| 14454 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14455 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14456 | * the vref |
| 14457 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14458 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14459 | |
| 14460 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14461 | #if 0 |
| 14462 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14463 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14464 | #endif |
| 14465 | { } /* end */ |
| 14466 | }; |
| 14467 | /* Set mic1 nad line-in as output and mute mixer */ |
| 14468 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 14469 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14470 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14471 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14472 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14473 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14474 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14475 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14476 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14477 | |
| 14478 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14479 | #if 0 |
| 14480 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14481 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14482 | #endif |
| 14483 | { } /* end */ |
| 14484 | }; |
| 14485 | |
| 14486 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 14487 | { 2, alc861_asus_ch2_init }, |
| 14488 | { 6, alc861_asus_ch6_init }, |
| 14489 | }; |
| 14490 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14491 | /* patch-ALC861 */ |
| 14492 | |
| 14493 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 14494 | /* output mixer control */ |
| 14495 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14496 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14497 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14498 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14499 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14500 | |
| 14501 | /*Input mixer control */ |
| 14502 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14503 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14504 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14505 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14506 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14507 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14508 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14509 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14510 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14511 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14512 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14513 | { } /* end */ |
| 14514 | }; |
| 14515 | |
| 14516 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 14517 | /* output mixer control */ |
| 14518 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14519 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14520 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14521 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14522 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14523 | |
| 14524 | /* Input mixer control */ |
| 14525 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14526 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14527 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14528 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14529 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14530 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14531 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14532 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14533 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14534 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14535 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14536 | { |
| 14537 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14538 | .name = "Channel Mode", |
| 14539 | .info = alc_ch_mode_info, |
| 14540 | .get = alc_ch_mode_get, |
| 14541 | .put = alc_ch_mode_put, |
| 14542 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 14543 | }, |
| 14544 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14545 | }; |
| 14546 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14547 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14548 | /* output mixer control */ |
| 14549 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14550 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14551 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14552 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14553 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14554 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14555 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14556 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 14557 | /* output mixer control */ |
| 14558 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14559 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14560 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14561 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14562 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14563 | |
| 14564 | /* Input mixer control */ |
| 14565 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14566 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14567 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14568 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14569 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14570 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14571 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14572 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14573 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14574 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14575 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14576 | { |
| 14577 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14578 | .name = "Channel Mode", |
| 14579 | .info = alc_ch_mode_info, |
| 14580 | .get = alc_ch_mode_get, |
| 14581 | .put = alc_ch_mode_put, |
| 14582 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14583 | }, |
| 14584 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14585 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14586 | |
| 14587 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 14588 | /* output mixer control */ |
| 14589 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14590 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14591 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14592 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14593 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14594 | |
| 14595 | /* Input mixer control */ |
| 14596 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14597 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14598 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14599 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14600 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14601 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14602 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14603 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14604 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14605 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 14606 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14607 | { |
| 14608 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14609 | .name = "Channel Mode", |
| 14610 | .info = alc_ch_mode_info, |
| 14611 | .get = alc_ch_mode_get, |
| 14612 | .put = alc_ch_mode_put, |
| 14613 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 14614 | }, |
| 14615 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14616 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14617 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14618 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14619 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14620 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14621 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14622 | { } |
| 14623 | }; |
| 14624 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14625 | /* |
| 14626 | * generic initialization of ADC, input mixers and output mixers |
| 14627 | */ |
| 14628 | static struct hda_verb alc861_base_init_verbs[] = { |
| 14629 | /* |
| 14630 | * Unmute ADC0 and set the default input to mic-in |
| 14631 | */ |
| 14632 | /* port-A for surround (rear panel) */ |
| 14633 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14634 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14635 | /* port-B for mic-in (rear panel) with vref */ |
| 14636 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14637 | /* port-C for line-in (rear panel) */ |
| 14638 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14639 | /* port-D for Front */ |
| 14640 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14641 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14642 | /* port-E for HP out (front panel) */ |
| 14643 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14644 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14645 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14646 | /* port-F for mic-in (front panel) with vref */ |
| 14647 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14648 | /* port-G for CLFE (rear panel) */ |
| 14649 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14650 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14651 | /* port-H for side (rear panel) */ |
| 14652 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14653 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14654 | /* CD-in */ |
| 14655 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14656 | /* route front mic to ADC1*/ |
| 14657 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14658 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14659 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14660 | /* Unmute DAC0~3 & spdif out*/ |
| 14661 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14662 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14663 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14664 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14665 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14666 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14667 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14668 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14669 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14670 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14671 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14672 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14673 | /* Unmute Stereo Mixer 15 */ |
| 14674 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14675 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14676 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14677 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14678 | |
| 14679 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14680 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14681 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14682 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14683 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14684 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14685 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14686 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14687 | /* hp used DAC 3 (Front) */ |
| 14688 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14689 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14690 | |
| 14691 | { } |
| 14692 | }; |
| 14693 | |
| 14694 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 14695 | /* |
| 14696 | * Unmute ADC0 and set the default input to mic-in |
| 14697 | */ |
| 14698 | /* port-A for surround (rear panel) */ |
| 14699 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14700 | /* port-B for mic-in (rear panel) with vref */ |
| 14701 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14702 | /* port-C for line-in (rear panel) */ |
| 14703 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14704 | /* port-D for Front */ |
| 14705 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14706 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14707 | /* port-E for HP out (front panel) */ |
| 14708 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14709 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14710 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14711 | /* port-F for mic-in (front panel) with vref */ |
| 14712 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14713 | /* port-G for CLFE (rear panel) */ |
| 14714 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14715 | /* port-H for side (rear panel) */ |
| 14716 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14717 | /* CD-in */ |
| 14718 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14719 | /* route front mic to ADC1*/ |
| 14720 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14721 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14722 | /* Unmute DAC0~3 & spdif out*/ |
| 14723 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14724 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14725 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14726 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14727 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14728 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14729 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14730 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14731 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14732 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14733 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14734 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14735 | /* Unmute Stereo Mixer 15 */ |
| 14736 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14737 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14738 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14739 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14740 | |
| 14741 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14742 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14743 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14744 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14745 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14746 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14747 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14748 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14749 | /* hp used DAC 3 (Front) */ |
| 14750 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14751 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14752 | { } |
| 14753 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14754 | |
| 14755 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 14756 | /* |
| 14757 | * Unmute ADC0 and set the default input to mic-in |
| 14758 | */ |
| 14759 | /* port-A for surround (rear panel) */ |
| 14760 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14761 | /* port-B for mic-in (rear panel) with vref */ |
| 14762 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14763 | /* port-C for line-in (rear panel) */ |
| 14764 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14765 | /* port-D for Front */ |
| 14766 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14767 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14768 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14769 | /* this has to be set to VREF80 */ |
| 14770 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14771 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14772 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14773 | /* port-F for mic-in (front panel) with vref */ |
| 14774 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14775 | /* port-G for CLFE (rear panel) */ |
| 14776 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14777 | /* port-H for side (rear panel) */ |
| 14778 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14779 | /* CD-in */ |
| 14780 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14781 | /* route front mic to ADC1*/ |
| 14782 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14783 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14784 | /* Unmute DAC0~3 & spdif out*/ |
| 14785 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14786 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14787 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14788 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14789 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14790 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14791 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14792 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14793 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14794 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14795 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14796 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14797 | /* Unmute Stereo Mixer 15 */ |
| 14798 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14799 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14800 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14801 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14802 | |
| 14803 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14804 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14805 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14806 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14807 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14808 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14809 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14810 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14811 | /* hp used DAC 3 (Front) */ |
| 14812 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14813 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14814 | { } |
| 14815 | }; |
| 14816 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14817 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 14818 | /* |
| 14819 | * Unmute ADC0 and set the default input to mic-in |
| 14820 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14821 | /* port-A for surround (rear panel) |
| 14822 | * according to codec#0 this is the HP jack |
| 14823 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14824 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 14825 | /* route front PCM to HP */ |
| 14826 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14827 | /* port-B for mic-in (rear panel) with vref */ |
| 14828 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14829 | /* port-C for line-in (rear panel) */ |
| 14830 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14831 | /* port-D for Front */ |
| 14832 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14833 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14834 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14835 | /* this has to be set to VREF80 */ |
| 14836 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14837 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14838 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14839 | /* port-F for mic-in (front panel) with vref */ |
| 14840 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14841 | /* port-G for CLFE (rear panel) */ |
| 14842 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14843 | /* port-H for side (rear panel) */ |
| 14844 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14845 | /* CD-in */ |
| 14846 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14847 | /* route front mic to ADC1*/ |
| 14848 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14849 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14850 | /* Unmute DAC0~3 & spdif out*/ |
| 14851 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14852 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14853 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14854 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14855 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14856 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14857 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14858 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14859 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14860 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14861 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14862 | /* Unmute Stereo Mixer 15 */ |
| 14863 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14864 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14865 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14866 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14867 | |
| 14868 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14869 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14870 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14871 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14872 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14873 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14874 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14875 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14876 | /* hp used DAC 3 (Front) */ |
| 14877 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14878 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14879 | { } |
| 14880 | }; |
| 14881 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14882 | /* additional init verbs for ASUS laptops */ |
| 14883 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 14884 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 14885 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 14886 | { } |
| 14887 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14888 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14889 | /* |
| 14890 | * generic initialization of ADC, input mixers and output mixers |
| 14891 | */ |
| 14892 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 14893 | /* |
| 14894 | * Unmute ADC0 and set the default input to mic-in |
| 14895 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14896 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14897 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14898 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14899 | /* Unmute DAC0~3 & spdif out*/ |
| 14900 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14901 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14902 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14903 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14904 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14905 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14906 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14907 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14908 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14909 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14910 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14911 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14912 | /* Unmute Stereo Mixer 15 */ |
| 14913 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14914 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14915 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14916 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 14917 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14918 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14919 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14920 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14921 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14922 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14923 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14924 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14925 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14926 | |
| 14927 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14928 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14929 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14930 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14931 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14932 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14933 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14934 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14935 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14936 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14937 | |
| 14938 | { } |
| 14939 | }; |
| 14940 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14941 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 14942 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14943 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14944 | { } |
| 14945 | }; |
| 14946 | |
| 14947 | /* toggle speaker-output according to the hp-jack state */ |
| 14948 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 14949 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14950 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14951 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14952 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 14953 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 14954 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 14955 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14956 | } |
| 14957 | |
| 14958 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 14959 | unsigned int res) |
| 14960 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14961 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14962 | alc861_toshiba_automute(codec); |
| 14963 | } |
| 14964 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14965 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14966 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 14967 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 14968 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 14969 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 14970 | |
| 14971 | |
| 14972 | #define ALC861_DIGOUT_NID 0x07 |
| 14973 | |
| 14974 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 14975 | { 8, NULL } |
| 14976 | }; |
| 14977 | |
| 14978 | static hda_nid_t alc861_dac_nids[4] = { |
| 14979 | /* front, surround, clfe, side */ |
| 14980 | 0x03, 0x06, 0x05, 0x04 |
| 14981 | }; |
| 14982 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14983 | static hda_nid_t alc660_dac_nids[3] = { |
| 14984 | /* front, clfe, surround */ |
| 14985 | 0x03, 0x05, 0x06 |
| 14986 | }; |
| 14987 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14988 | static hda_nid_t alc861_adc_nids[1] = { |
| 14989 | /* ADC0-2 */ |
| 14990 | 0x08, |
| 14991 | }; |
| 14992 | |
| 14993 | static struct hda_input_mux alc861_capture_source = { |
| 14994 | .num_items = 5, |
| 14995 | .items = { |
| 14996 | { "Mic", 0x0 }, |
| 14997 | { "Front Mic", 0x3 }, |
| 14998 | { "Line", 0x1 }, |
| 14999 | { "CD", 0x4 }, |
| 15000 | { "Mixer", 0x5 }, |
| 15001 | }, |
| 15002 | }; |
| 15003 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15004 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15005 | { |
| 15006 | struct alc_spec *spec = codec->spec; |
| 15007 | hda_nid_t mix, srcs[5]; |
| 15008 | int i, j, num; |
| 15009 | |
| 15010 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15011 | return 0; |
| 15012 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15013 | if (num < 0) |
| 15014 | return 0; |
| 15015 | for (i = 0; i < num; i++) { |
| 15016 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15017 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15018 | if (type != AC_WID_AUD_OUT) |
| 15019 | continue; |
| 15020 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15021 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15022 | break; |
| 15023 | if (j >= spec->multiout.num_dacs) |
| 15024 | return srcs[i]; |
| 15025 | } |
| 15026 | return 0; |
| 15027 | } |
| 15028 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15029 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15030 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15031 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15032 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15033 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15034 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15035 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15036 | |
| 15037 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15038 | for (i = 0; i < cfg->line_outs; i++) { |
| 15039 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15040 | dac = alc861_look_for_dac(codec, nid); |
| 15041 | if (!dac) |
| 15042 | continue; |
| 15043 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15044 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15045 | return 0; |
| 15046 | } |
| 15047 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15048 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15049 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15050 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15051 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15052 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15053 | } |
| 15054 | |
| 15055 | /* add playback controls from the parsed DAC table */ |
| 15056 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15057 | const struct auto_pin_cfg *cfg) |
| 15058 | { |
| 15059 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15060 | static const char *chname[4] = { |
| 15061 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15062 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15063 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15064 | int i, err; |
| 15065 | |
| 15066 | if (cfg->line_outs == 1) { |
| 15067 | const char *pfx = NULL; |
| 15068 | if (!cfg->hp_outs) |
| 15069 | pfx = "Master"; |
| 15070 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15071 | pfx = "Speaker"; |
| 15072 | if (pfx) { |
| 15073 | nid = spec->multiout.dac_nids[0]; |
| 15074 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 15075 | } |
| 15076 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15077 | |
| 15078 | for (i = 0; i < cfg->line_outs; i++) { |
| 15079 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15080 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15081 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15082 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15083 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15084 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15085 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15086 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15087 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15088 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15089 | return err; |
| 15090 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15091 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15092 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15093 | return err; |
| 15094 | } |
| 15095 | } |
| 15096 | return 0; |
| 15097 | } |
| 15098 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15099 | 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] | 15100 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15101 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15102 | int err; |
| 15103 | hda_nid_t nid; |
| 15104 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15105 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15106 | return 0; |
| 15107 | |
| 15108 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15109 | nid = alc861_look_for_dac(codec, pin); |
| 15110 | if (nid) { |
| 15111 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15112 | if (err < 0) |
| 15113 | return err; |
| 15114 | spec->multiout.hp_nid = nid; |
| 15115 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15116 | } |
| 15117 | return 0; |
| 15118 | } |
| 15119 | |
| 15120 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15121 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15122 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15123 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15124 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15125 | } |
| 15126 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15127 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15128 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15129 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15130 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15131 | hda_nid_t mix, srcs[5]; |
| 15132 | int i, num; |
| 15133 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15134 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15135 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15136 | 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] | 15137 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15138 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 15139 | return; |
| 15140 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15141 | if (num < 0) |
| 15142 | return; |
| 15143 | for (i = 0; i < num; i++) { |
| 15144 | unsigned int mute; |
| 15145 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 15146 | mute = AMP_IN_UNMUTE(i); |
| 15147 | else |
| 15148 | mute = AMP_IN_MUTE(i); |
| 15149 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15150 | mute); |
| 15151 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15152 | } |
| 15153 | |
| 15154 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 15155 | { |
| 15156 | struct alc_spec *spec = codec->spec; |
| 15157 | int i; |
| 15158 | |
| 15159 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 15160 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15161 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15162 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15163 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15164 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15165 | } |
| 15166 | } |
| 15167 | |
| 15168 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 15169 | { |
| 15170 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15171 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15172 | if (spec->autocfg.hp_outs) |
| 15173 | alc861_auto_set_output_and_unmute(codec, |
| 15174 | spec->autocfg.hp_pins[0], |
| 15175 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15176 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15177 | if (spec->autocfg.speaker_outs) |
| 15178 | alc861_auto_set_output_and_unmute(codec, |
| 15179 | spec->autocfg.speaker_pins[0], |
| 15180 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15181 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15182 | } |
| 15183 | |
| 15184 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 15185 | { |
| 15186 | struct alc_spec *spec = codec->spec; |
| 15187 | int i; |
| 15188 | |
| 15189 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15190 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15191 | if (nid >= 0x0c && nid <= 0x11) |
| 15192 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15193 | } |
| 15194 | } |
| 15195 | |
| 15196 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15197 | /* return 1 if successful, 0 if the proper config is not found, |
| 15198 | * or a negative error code |
| 15199 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15200 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 15201 | { |
| 15202 | struct alc_spec *spec = codec->spec; |
| 15203 | int err; |
| 15204 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 15205 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15206 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15207 | alc861_ignore); |
| 15208 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15209 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15210 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15211 | return 0; /* can't find valid BIOS pin config */ |
| 15212 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15213 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15214 | if (err < 0) |
| 15215 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15216 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15217 | if (err < 0) |
| 15218 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15219 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15220 | if (err < 0) |
| 15221 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15222 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15223 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15224 | return err; |
| 15225 | |
| 15226 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15227 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15228 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15229 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 15230 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15231 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15232 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15233 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15234 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15235 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 15236 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15237 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15238 | |
| 15239 | spec->adc_nids = alc861_adc_nids; |
| 15240 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15241 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15242 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 15243 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15244 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15245 | return 1; |
| 15246 | } |
| 15247 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15248 | /* additional initialization for auto-configuration model */ |
| 15249 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15250 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15251 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15252 | alc861_auto_init_multi_out(codec); |
| 15253 | alc861_auto_init_hp_out(codec); |
| 15254 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15255 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15256 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15257 | } |
| 15258 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15259 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15260 | static struct hda_amp_list alc861_loopbacks[] = { |
| 15261 | { 0x15, HDA_INPUT, 0 }, |
| 15262 | { 0x15, HDA_INPUT, 1 }, |
| 15263 | { 0x15, HDA_INPUT, 2 }, |
| 15264 | { 0x15, HDA_INPUT, 3 }, |
| 15265 | { } /* end */ |
| 15266 | }; |
| 15267 | #endif |
| 15268 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15269 | |
| 15270 | /* |
| 15271 | * configuration and preset |
| 15272 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15273 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 15274 | [ALC861_3ST] = "3stack", |
| 15275 | [ALC660_3ST] = "3stack-660", |
| 15276 | [ALC861_3ST_DIG] = "3stack-dig", |
| 15277 | [ALC861_6ST_DIG] = "6stack-dig", |
| 15278 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 15279 | [ALC861_TOSHIBA] = "toshiba", |
| 15280 | [ALC861_ASUS] = "asus", |
| 15281 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 15282 | [ALC861_AUTO] = "auto", |
| 15283 | }; |
| 15284 | |
| 15285 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 15286 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15287 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15288 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15289 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15290 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 15291 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 15292 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 15293 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 15294 | * Any other models that need this preset? |
| 15295 | */ |
| 15296 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 15297 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 15298 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15299 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 15300 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 15301 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 15302 | /* FIXME: the below seems conflict */ |
| 15303 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 15304 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 15305 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15306 | {} |
| 15307 | }; |
| 15308 | |
| 15309 | static struct alc_config_preset alc861_presets[] = { |
| 15310 | [ALC861_3ST] = { |
| 15311 | .mixers = { alc861_3ST_mixer }, |
| 15312 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15313 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15314 | .dac_nids = alc861_dac_nids, |
| 15315 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15316 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15317 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15318 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15319 | .adc_nids = alc861_adc_nids, |
| 15320 | .input_mux = &alc861_capture_source, |
| 15321 | }, |
| 15322 | [ALC861_3ST_DIG] = { |
| 15323 | .mixers = { alc861_base_mixer }, |
| 15324 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15325 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15326 | .dac_nids = alc861_dac_nids, |
| 15327 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15328 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15329 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15330 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15331 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15332 | .adc_nids = alc861_adc_nids, |
| 15333 | .input_mux = &alc861_capture_source, |
| 15334 | }, |
| 15335 | [ALC861_6ST_DIG] = { |
| 15336 | .mixers = { alc861_base_mixer }, |
| 15337 | .init_verbs = { alc861_base_init_verbs }, |
| 15338 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15339 | .dac_nids = alc861_dac_nids, |
| 15340 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15341 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 15342 | .channel_mode = alc861_8ch_modes, |
| 15343 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15344 | .adc_nids = alc861_adc_nids, |
| 15345 | .input_mux = &alc861_capture_source, |
| 15346 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15347 | [ALC660_3ST] = { |
| 15348 | .mixers = { alc861_3ST_mixer }, |
| 15349 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15350 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 15351 | .dac_nids = alc660_dac_nids, |
| 15352 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15353 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15354 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15355 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15356 | .adc_nids = alc861_adc_nids, |
| 15357 | .input_mux = &alc861_capture_source, |
| 15358 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15359 | [ALC861_UNIWILL_M31] = { |
| 15360 | .mixers = { alc861_uniwill_m31_mixer }, |
| 15361 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 15362 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15363 | .dac_nids = alc861_dac_nids, |
| 15364 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15365 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15366 | .channel_mode = alc861_uniwill_m31_modes, |
| 15367 | .need_dac_fix = 1, |
| 15368 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15369 | .adc_nids = alc861_adc_nids, |
| 15370 | .input_mux = &alc861_capture_source, |
| 15371 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15372 | [ALC861_TOSHIBA] = { |
| 15373 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15374 | .init_verbs = { alc861_base_init_verbs, |
| 15375 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15376 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15377 | .dac_nids = alc861_dac_nids, |
| 15378 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15379 | .channel_mode = alc883_3ST_2ch_modes, |
| 15380 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15381 | .adc_nids = alc861_adc_nids, |
| 15382 | .input_mux = &alc861_capture_source, |
| 15383 | .unsol_event = alc861_toshiba_unsol_event, |
| 15384 | .init_hook = alc861_toshiba_automute, |
| 15385 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15386 | [ALC861_ASUS] = { |
| 15387 | .mixers = { alc861_asus_mixer }, |
| 15388 | .init_verbs = { alc861_asus_init_verbs }, |
| 15389 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15390 | .dac_nids = alc861_dac_nids, |
| 15391 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15392 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 15393 | .channel_mode = alc861_asus_modes, |
| 15394 | .need_dac_fix = 1, |
| 15395 | .hp_nid = 0x06, |
| 15396 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15397 | .adc_nids = alc861_adc_nids, |
| 15398 | .input_mux = &alc861_capture_source, |
| 15399 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15400 | [ALC861_ASUS_LAPTOP] = { |
| 15401 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 15402 | .init_verbs = { alc861_asus_init_verbs, |
| 15403 | alc861_asus_laptop_init_verbs }, |
| 15404 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15405 | .dac_nids = alc861_dac_nids, |
| 15406 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15407 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15408 | .channel_mode = alc883_3ST_2ch_modes, |
| 15409 | .need_dac_fix = 1, |
| 15410 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15411 | .adc_nids = alc861_adc_nids, |
| 15412 | .input_mux = &alc861_capture_source, |
| 15413 | }, |
| 15414 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15415 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15416 | /* Pin config fixes */ |
| 15417 | enum { |
| 15418 | PINFIX_FSC_AMILO_PI1505, |
| 15419 | }; |
| 15420 | |
| 15421 | static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = { |
| 15422 | { 0x0b, 0x0221101f }, /* HP */ |
| 15423 | { 0x0f, 0x90170310 }, /* speaker */ |
| 15424 | { } |
| 15425 | }; |
| 15426 | |
| 15427 | static const struct alc_fixup alc861_fixups[] = { |
| 15428 | [PINFIX_FSC_AMILO_PI1505] = { |
| 15429 | .pins = alc861_fsc_amilo_pi1505_pinfix |
| 15430 | }, |
| 15431 | }; |
| 15432 | |
| 15433 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 15434 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 15435 | {} |
| 15436 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15437 | |
| 15438 | static int patch_alc861(struct hda_codec *codec) |
| 15439 | { |
| 15440 | struct alc_spec *spec; |
| 15441 | int board_config; |
| 15442 | int err; |
| 15443 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 15444 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15445 | if (spec == NULL) |
| 15446 | return -ENOMEM; |
| 15447 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15448 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15449 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15450 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 15451 | alc861_models, |
| 15452 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15453 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15454 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15455 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15456 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15457 | board_config = ALC861_AUTO; |
| 15458 | } |
| 15459 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 15460 | if (board_config == ALC861_AUTO) |
| 15461 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15462 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15463 | if (board_config == ALC861_AUTO) { |
| 15464 | /* automatic parse from the BIOS config */ |
| 15465 | err = alc861_parse_auto_config(codec); |
| 15466 | if (err < 0) { |
| 15467 | alc_free(codec); |
| 15468 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15469 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15470 | printk(KERN_INFO |
| 15471 | "hda_codec: Cannot set up configuration " |
| 15472 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15473 | board_config = ALC861_3ST_DIG; |
| 15474 | } |
| 15475 | } |
| 15476 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15477 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15478 | if (err < 0) { |
| 15479 | alc_free(codec); |
| 15480 | return err; |
| 15481 | } |
| 15482 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15483 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15484 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15485 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15486 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 15487 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 15488 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15489 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 15490 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 15491 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 15492 | if (!spec->cap_mixer) |
| 15493 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15494 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 15495 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15496 | spec->vmaster_nid = 0x03; |
| 15497 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 15498 | if (board_config == ALC861_AUTO) |
| 15499 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); |
| 15500 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15501 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15502 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15503 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15504 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15505 | spec->power_hook = alc_power_eapd; |
| 15506 | #endif |
| 15507 | } |
| 15508 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15509 | if (!spec->loopback.amplist) |
| 15510 | spec->loopback.amplist = alc861_loopbacks; |
| 15511 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15512 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15513 | return 0; |
| 15514 | } |
| 15515 | |
| 15516 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15517 | * ALC861-VD support |
| 15518 | * |
| 15519 | * Based on ALC882 |
| 15520 | * |
| 15521 | * In addition, an independent DAC |
| 15522 | */ |
| 15523 | #define ALC861VD_DIGOUT_NID 0x06 |
| 15524 | |
| 15525 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 15526 | /* front, surr, clfe, side surr */ |
| 15527 | 0x02, 0x03, 0x04, 0x05 |
| 15528 | }; |
| 15529 | |
| 15530 | /* dac_nids for ALC660vd are in a different order - according to |
| 15531 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15532 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15533 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 15534 | * - and it is the same as in 861vd. |
| 15535 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 15536 | */ |
| 15537 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 15538 | /* front, rear, clfe, rear_surr */ |
| 15539 | 0x02, 0x04, 0x03 |
| 15540 | }; |
| 15541 | |
| 15542 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 15543 | /* ADC0 */ |
| 15544 | 0x09, |
| 15545 | }; |
| 15546 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15547 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 15548 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15549 | /* input MUX */ |
| 15550 | /* FIXME: should be a matrix-type input source selection */ |
| 15551 | static struct hda_input_mux alc861vd_capture_source = { |
| 15552 | .num_items = 4, |
| 15553 | .items = { |
| 15554 | { "Mic", 0x0 }, |
| 15555 | { "Front Mic", 0x1 }, |
| 15556 | { "Line", 0x2 }, |
| 15557 | { "CD", 0x4 }, |
| 15558 | }, |
| 15559 | }; |
| 15560 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15561 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15562 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15563 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15564 | { "Ext Mic", 0x0 }, |
| 15565 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15566 | }, |
| 15567 | }; |
| 15568 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15569 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 15570 | .num_items = 2, |
| 15571 | .items = { |
| 15572 | { "Front Mic", 0x0 }, |
| 15573 | { "ATAPI Mic", 0x1 }, |
| 15574 | }, |
| 15575 | }; |
| 15576 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15577 | /* |
| 15578 | * 2ch mode |
| 15579 | */ |
| 15580 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 15581 | { 2, NULL } |
| 15582 | }; |
| 15583 | |
| 15584 | /* |
| 15585 | * 6ch mode |
| 15586 | */ |
| 15587 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 15588 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15589 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15590 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15591 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15592 | { } /* end */ |
| 15593 | }; |
| 15594 | |
| 15595 | /* |
| 15596 | * 8ch mode |
| 15597 | */ |
| 15598 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 15599 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15600 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15601 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15602 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15603 | { } /* end */ |
| 15604 | }; |
| 15605 | |
| 15606 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 15607 | { 6, alc861vd_6stack_ch6_init }, |
| 15608 | { 8, alc861vd_6stack_ch8_init }, |
| 15609 | }; |
| 15610 | |
| 15611 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 15612 | { |
| 15613 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15614 | .name = "Channel Mode", |
| 15615 | .info = alc_ch_mode_info, |
| 15616 | .get = alc_ch_mode_get, |
| 15617 | .put = alc_ch_mode_put, |
| 15618 | }, |
| 15619 | { } /* end */ |
| 15620 | }; |
| 15621 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15622 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15623 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15624 | */ |
| 15625 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 15626 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15627 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15628 | |
| 15629 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15630 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 15631 | |
| 15632 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 15633 | HDA_OUTPUT), |
| 15634 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 15635 | HDA_OUTPUT), |
| 15636 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 15637 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 15638 | |
| 15639 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 15640 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 15641 | |
| 15642 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15643 | |
| 15644 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15645 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15646 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15647 | |
| 15648 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15649 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15650 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15651 | |
| 15652 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15653 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15654 | |
| 15655 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15656 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15657 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15658 | { } /* end */ |
| 15659 | }; |
| 15660 | |
| 15661 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 15662 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15663 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15664 | |
| 15665 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15666 | |
| 15667 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15668 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15669 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15670 | |
| 15671 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15672 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15673 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15674 | |
| 15675 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15676 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15677 | |
| 15678 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15679 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15680 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15681 | { } /* end */ |
| 15682 | }; |
| 15683 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15684 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 15685 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15686 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 15687 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15688 | |
| 15689 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15690 | |
| 15691 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15692 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15693 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15694 | |
| 15695 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15696 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15697 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15698 | |
| 15699 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15700 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15701 | |
| 15702 | { } /* end */ |
| 15703 | }; |
| 15704 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15705 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 15706 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15707 | */ |
| 15708 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15709 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15710 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15711 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15712 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15713 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 15714 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15715 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15716 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 15717 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15718 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15719 | { } /* end */ |
| 15720 | }; |
| 15721 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15722 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 15723 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 15724 | */ |
| 15725 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 15726 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15727 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15728 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15729 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 15730 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15731 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15732 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15733 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15734 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15735 | { } /* end */ |
| 15736 | }; |
| 15737 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15738 | /* |
| 15739 | * generic initialization of ADC, input mixers and output mixers |
| 15740 | */ |
| 15741 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 15742 | /* |
| 15743 | * Unmute ADC0 and set the default input to mic-in |
| 15744 | */ |
| 15745 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15746 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15747 | |
| 15748 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 15749 | * the analog-loopback mixer widget |
| 15750 | */ |
| 15751 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15752 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15753 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15754 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15755 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15756 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15757 | |
| 15758 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15759 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15760 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15761 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15762 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15763 | |
| 15764 | /* |
| 15765 | * Set up output mixers (0x02 - 0x05) |
| 15766 | */ |
| 15767 | /* set vol=0 to output mixers */ |
| 15768 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15769 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15770 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15771 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15772 | |
| 15773 | /* set up input amps for analog loopback */ |
| 15774 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 15775 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15776 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15777 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15778 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15779 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15780 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15781 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15782 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15783 | |
| 15784 | { } |
| 15785 | }; |
| 15786 | |
| 15787 | /* |
| 15788 | * 3-stack pin configuration: |
| 15789 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 15790 | */ |
| 15791 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 15792 | /* |
| 15793 | * Set pin mode and muting |
| 15794 | */ |
| 15795 | /* set front pin widgets 0x14 for output */ |
| 15796 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15797 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15798 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15799 | |
| 15800 | /* Mic (rear) pin: input vref at 80% */ |
| 15801 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15802 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15803 | /* Front Mic pin: input vref at 80% */ |
| 15804 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15805 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15806 | /* Line In pin: input */ |
| 15807 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15808 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15809 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15810 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15811 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15812 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15813 | /* CD pin widget for input */ |
| 15814 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15815 | |
| 15816 | { } |
| 15817 | }; |
| 15818 | |
| 15819 | /* |
| 15820 | * 6-stack pin configuration: |
| 15821 | */ |
| 15822 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 15823 | /* |
| 15824 | * Set pin mode and muting |
| 15825 | */ |
| 15826 | /* set front pin widgets 0x14 for output */ |
| 15827 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15828 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15829 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15830 | |
| 15831 | /* Rear Pin: output 1 (0x0d) */ |
| 15832 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15833 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15834 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 15835 | /* CLFE Pin: output 2 (0x0e) */ |
| 15836 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15837 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15838 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 15839 | /* Side Pin: output 3 (0x0f) */ |
| 15840 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15841 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15842 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 15843 | |
| 15844 | /* Mic (rear) pin: input vref at 80% */ |
| 15845 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15846 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15847 | /* Front Mic pin: input vref at 80% */ |
| 15848 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15849 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15850 | /* Line In pin: input */ |
| 15851 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15852 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15853 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15854 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15855 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15856 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15857 | /* CD pin widget for input */ |
| 15858 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15859 | |
| 15860 | { } |
| 15861 | }; |
| 15862 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15863 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 15864 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15865 | { } |
| 15866 | }; |
| 15867 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15868 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 15869 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15870 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15871 | { } |
| 15872 | }; |
| 15873 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15874 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 15875 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15876 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15877 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 15878 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15879 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15880 | {} |
| 15881 | }; |
| 15882 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15883 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 15884 | { |
| 15885 | unsigned int present; |
| 15886 | unsigned char bits; |
| 15887 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15888 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15889 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15890 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15891 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 15892 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15893 | } |
| 15894 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15895 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15896 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15897 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15898 | spec->autocfg.hp_pins[0] = 0x1b; |
| 15899 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15900 | } |
| 15901 | |
| 15902 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 15903 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15904 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15905 | alc861vd_lenovo_mic_automute(codec); |
| 15906 | } |
| 15907 | |
| 15908 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 15909 | unsigned int res) |
| 15910 | { |
| 15911 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15912 | case ALC880_MIC_EVENT: |
| 15913 | alc861vd_lenovo_mic_automute(codec); |
| 15914 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15915 | default: |
| 15916 | alc_automute_amp_unsol_event(codec, res); |
| 15917 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15918 | } |
| 15919 | } |
| 15920 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15921 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 15922 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15923 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15924 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15925 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15926 | |
| 15927 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15928 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15929 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15930 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15931 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15932 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15933 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15934 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15935 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15936 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15937 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15938 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15939 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15940 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15941 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15942 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15943 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15944 | |
| 15945 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15946 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15947 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15948 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15949 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15950 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15951 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15952 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15953 | |
| 15954 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15955 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15956 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15957 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 15958 | |
| 15959 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15960 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15961 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15962 | |
| 15963 | { } /* end */ |
| 15964 | }; |
| 15965 | |
| 15966 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15967 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15968 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15969 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15970 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15971 | spec->autocfg.hp_pins[0] = 0x15; |
| 15972 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15973 | } |
| 15974 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15975 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15976 | #define alc861vd_loopbacks alc880_loopbacks |
| 15977 | #endif |
| 15978 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15979 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15980 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 15981 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 15982 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 15983 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 15984 | |
| 15985 | /* |
| 15986 | * configuration and preset |
| 15987 | */ |
| 15988 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 15989 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15990 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15991 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15992 | [ALC861VD_3ST] = "3stack", |
| 15993 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 15994 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15995 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15996 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15997 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15998 | [ALC861VD_AUTO] = "auto", |
| 15999 | }; |
| 16000 | |
| 16001 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16002 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16003 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16004 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16005 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16006 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16007 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16008 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16009 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16010 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16011 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16012 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16013 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16014 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16015 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16016 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16017 | {} |
| 16018 | }; |
| 16019 | |
| 16020 | static struct alc_config_preset alc861vd_presets[] = { |
| 16021 | [ALC660VD_3ST] = { |
| 16022 | .mixers = { alc861vd_3st_mixer }, |
| 16023 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16024 | alc861vd_3stack_init_verbs }, |
| 16025 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16026 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16027 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16028 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16029 | .input_mux = &alc861vd_capture_source, |
| 16030 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16031 | [ALC660VD_3ST_DIG] = { |
| 16032 | .mixers = { alc861vd_3st_mixer }, |
| 16033 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16034 | alc861vd_3stack_init_verbs }, |
| 16035 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16036 | .dac_nids = alc660vd_dac_nids, |
| 16037 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16038 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16039 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16040 | .input_mux = &alc861vd_capture_source, |
| 16041 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16042 | [ALC861VD_3ST] = { |
| 16043 | .mixers = { alc861vd_3st_mixer }, |
| 16044 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16045 | alc861vd_3stack_init_verbs }, |
| 16046 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16047 | .dac_nids = alc861vd_dac_nids, |
| 16048 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16049 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16050 | .input_mux = &alc861vd_capture_source, |
| 16051 | }, |
| 16052 | [ALC861VD_3ST_DIG] = { |
| 16053 | .mixers = { alc861vd_3st_mixer }, |
| 16054 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16055 | alc861vd_3stack_init_verbs }, |
| 16056 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16057 | .dac_nids = alc861vd_dac_nids, |
| 16058 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16059 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16060 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16061 | .input_mux = &alc861vd_capture_source, |
| 16062 | }, |
| 16063 | [ALC861VD_6ST_DIG] = { |
| 16064 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16065 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16066 | alc861vd_6stack_init_verbs }, |
| 16067 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16068 | .dac_nids = alc861vd_dac_nids, |
| 16069 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16070 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16071 | .channel_mode = alc861vd_6stack_modes, |
| 16072 | .input_mux = &alc861vd_capture_source, |
| 16073 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16074 | [ALC861VD_LENOVO] = { |
| 16075 | .mixers = { alc861vd_lenovo_mixer }, |
| 16076 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16077 | alc861vd_3stack_init_verbs, |
| 16078 | alc861vd_eapd_verbs, |
| 16079 | alc861vd_lenovo_unsol_verbs }, |
| 16080 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16081 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16082 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16083 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16084 | .input_mux = &alc861vd_capture_source, |
| 16085 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16086 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16087 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16088 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16089 | [ALC861VD_DALLAS] = { |
| 16090 | .mixers = { alc861vd_dallas_mixer }, |
| 16091 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16092 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16093 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16094 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16095 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16096 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16097 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16098 | .setup = alc861vd_dallas_setup, |
| 16099 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16100 | }, |
| 16101 | [ALC861VD_HP] = { |
| 16102 | .mixers = { alc861vd_hp_mixer }, |
| 16103 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16104 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16105 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16106 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16107 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16108 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16109 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16110 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16111 | .setup = alc861vd_dallas_setup, |
| 16112 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16113 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16114 | [ALC660VD_ASUS_V1S] = { |
| 16115 | .mixers = { alc861vd_lenovo_mixer }, |
| 16116 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16117 | alc861vd_3stack_init_verbs, |
| 16118 | alc861vd_eapd_verbs, |
| 16119 | alc861vd_lenovo_unsol_verbs }, |
| 16120 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16121 | .dac_nids = alc660vd_dac_nids, |
| 16122 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16123 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16124 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16125 | .input_mux = &alc861vd_capture_source, |
| 16126 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16127 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16128 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16129 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16130 | }; |
| 16131 | |
| 16132 | /* |
| 16133 | * BIOS auto configuration |
| 16134 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16135 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 16136 | const struct auto_pin_cfg *cfg) |
| 16137 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16138 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16139 | } |
| 16140 | |
| 16141 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16142 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16143 | hda_nid_t nid, int pin_type, int dac_idx) |
| 16144 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16145 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16146 | } |
| 16147 | |
| 16148 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 16149 | { |
| 16150 | struct alc_spec *spec = codec->spec; |
| 16151 | int i; |
| 16152 | |
| 16153 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16154 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16155 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16156 | if (nid) |
| 16157 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16158 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16159 | } |
| 16160 | } |
| 16161 | |
| 16162 | |
| 16163 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 16164 | { |
| 16165 | struct alc_spec *spec = codec->spec; |
| 16166 | hda_nid_t pin; |
| 16167 | |
| 16168 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16169 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16170 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16171 | pin = spec->autocfg.speaker_pins[0]; |
| 16172 | if (pin) |
| 16173 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16174 | } |
| 16175 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16176 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 16177 | |
| 16178 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 16179 | { |
| 16180 | struct alc_spec *spec = codec->spec; |
| 16181 | int i; |
| 16182 | |
| 16183 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16184 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16185 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16186 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 16187 | if (nid != ALC861VD_PIN_CD_NID && |
| 16188 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16189 | snd_hda_codec_write(codec, nid, 0, |
| 16190 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16191 | AMP_OUT_MUTE); |
| 16192 | } |
| 16193 | } |
| 16194 | } |
| 16195 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16196 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 16197 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16198 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 16199 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 16200 | |
| 16201 | /* add playback controls from the parsed DAC table */ |
| 16202 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16203 | * different NIDs for mute/unmute switch and volume control */ |
| 16204 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16205 | const struct auto_pin_cfg *cfg) |
| 16206 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16207 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 16208 | hda_nid_t nid_v, nid_s; |
| 16209 | int i, err; |
| 16210 | |
| 16211 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16212 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16213 | continue; |
| 16214 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16215 | alc880_dac_to_idx( |
| 16216 | spec->multiout.dac_nids[i])); |
| 16217 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16218 | alc880_dac_to_idx( |
| 16219 | spec->multiout.dac_nids[i])); |
| 16220 | |
| 16221 | if (i == 2) { |
| 16222 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16223 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16224 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16225 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 16226 | HDA_OUTPUT)); |
| 16227 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16228 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16229 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16230 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16231 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 16232 | HDA_OUTPUT)); |
| 16233 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16234 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16235 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16236 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16237 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 16238 | HDA_INPUT)); |
| 16239 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16240 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16241 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16242 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16243 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 16244 | HDA_INPUT)); |
| 16245 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16246 | return err; |
| 16247 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16248 | const char *pfx; |
| 16249 | if (cfg->line_outs == 1 && |
| 16250 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 16251 | if (!cfg->hp_pins) |
| 16252 | pfx = "Speaker"; |
| 16253 | else |
| 16254 | pfx = "PCM"; |
| 16255 | } else |
| 16256 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16257 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16258 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 16259 | HDA_OUTPUT)); |
| 16260 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16261 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16262 | if (cfg->line_outs == 1 && |
| 16263 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 16264 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16265 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16266 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16267 | HDA_INPUT)); |
| 16268 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16269 | return err; |
| 16270 | } |
| 16271 | } |
| 16272 | return 0; |
| 16273 | } |
| 16274 | |
| 16275 | /* add playback controls for speaker and HP outputs */ |
| 16276 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16277 | * different NIDs for mute/unmute switch and volume control */ |
| 16278 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 16279 | hda_nid_t pin, const char *pfx) |
| 16280 | { |
| 16281 | hda_nid_t nid_v, nid_s; |
| 16282 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16283 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16284 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16285 | return 0; |
| 16286 | |
| 16287 | if (alc880_is_fixed_pin(pin)) { |
| 16288 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16289 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16290 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16291 | spec->multiout.hp_nid = nid_v; |
| 16292 | else |
| 16293 | spec->multiout.extra_out_nid[0] = nid_v; |
| 16294 | /* control HP volume/switch on the output mixer amp */ |
| 16295 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16296 | alc880_fixed_pin_idx(pin)); |
| 16297 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16298 | alc880_fixed_pin_idx(pin)); |
| 16299 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16300 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16301 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 16302 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16303 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16304 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16305 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 16306 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16307 | return err; |
| 16308 | } else if (alc880_is_multi_pin(pin)) { |
| 16309 | /* set manual connection */ |
| 16310 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16311 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16312 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16313 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16314 | return err; |
| 16315 | } |
| 16316 | return 0; |
| 16317 | } |
| 16318 | |
| 16319 | /* parse the BIOS configuration and set up the alc_spec |
| 16320 | * return 1 if successful, 0 if the proper config is not found, |
| 16321 | * or a negative error code |
| 16322 | * Based on ALC880 version - had to change it to override |
| 16323 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 16324 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 16325 | { |
| 16326 | struct alc_spec *spec = codec->spec; |
| 16327 | int err; |
| 16328 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 16329 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16330 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16331 | alc861vd_ignore); |
| 16332 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16333 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16334 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16335 | return 0; /* can't find valid BIOS pin config */ |
| 16336 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16337 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16338 | if (err < 0) |
| 16339 | return err; |
| 16340 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16341 | if (err < 0) |
| 16342 | return err; |
| 16343 | err = alc861vd_auto_create_extra_out(spec, |
| 16344 | spec->autocfg.speaker_pins[0], |
| 16345 | "Speaker"); |
| 16346 | if (err < 0) |
| 16347 | return err; |
| 16348 | err = alc861vd_auto_create_extra_out(spec, |
| 16349 | spec->autocfg.hp_pins[0], |
| 16350 | "Headphone"); |
| 16351 | if (err < 0) |
| 16352 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16353 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16354 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16355 | return err; |
| 16356 | |
| 16357 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16358 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 16359 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16360 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 16361 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16362 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16363 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16364 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16365 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16366 | |
| 16367 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16368 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16369 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 16370 | err = alc_auto_add_mic_boost(codec); |
| 16371 | if (err < 0) |
| 16372 | return err; |
| 16373 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16374 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16375 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16376 | return 1; |
| 16377 | } |
| 16378 | |
| 16379 | /* additional initialization for auto-configuration model */ |
| 16380 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 16381 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16382 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16383 | alc861vd_auto_init_multi_out(codec); |
| 16384 | alc861vd_auto_init_hp_out(codec); |
| 16385 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16386 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16387 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16388 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16389 | } |
| 16390 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16391 | enum { |
| 16392 | ALC660VD_FIX_ASUS_GPIO1 |
| 16393 | }; |
| 16394 | |
| 16395 | /* reset GPIO1 */ |
| 16396 | static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = { |
| 16397 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 16398 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 16399 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 16400 | { } |
| 16401 | }; |
| 16402 | |
| 16403 | static const struct alc_fixup alc861vd_fixups[] = { |
| 16404 | [ALC660VD_FIX_ASUS_GPIO1] = { |
| 16405 | .verbs = alc660vd_fix_asus_gpio1_verbs, |
| 16406 | }, |
| 16407 | }; |
| 16408 | |
| 16409 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 16410 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 16411 | {} |
| 16412 | }; |
| 16413 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16414 | static int patch_alc861vd(struct hda_codec *codec) |
| 16415 | { |
| 16416 | struct alc_spec *spec; |
| 16417 | int err, board_config; |
| 16418 | |
| 16419 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16420 | if (spec == NULL) |
| 16421 | return -ENOMEM; |
| 16422 | |
| 16423 | codec->spec = spec; |
| 16424 | |
| 16425 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 16426 | alc861vd_models, |
| 16427 | alc861vd_cfg_tbl); |
| 16428 | |
| 16429 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16430 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16431 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16432 | board_config = ALC861VD_AUTO; |
| 16433 | } |
| 16434 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16435 | if (board_config == ALC861VD_AUTO) |
| 16436 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16437 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16438 | if (board_config == ALC861VD_AUTO) { |
| 16439 | /* automatic parse from the BIOS config */ |
| 16440 | err = alc861vd_parse_auto_config(codec); |
| 16441 | if (err < 0) { |
| 16442 | alc_free(codec); |
| 16443 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16444 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16445 | printk(KERN_INFO |
| 16446 | "hda_codec: Cannot set up configuration " |
| 16447 | "from BIOS. Using base mode...\n"); |
| 16448 | board_config = ALC861VD_3ST; |
| 16449 | } |
| 16450 | } |
| 16451 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16452 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16453 | if (err < 0) { |
| 16454 | alc_free(codec); |
| 16455 | return err; |
| 16456 | } |
| 16457 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16458 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16459 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16460 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16461 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16462 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16463 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16464 | } |
| 16465 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16466 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 16467 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 16468 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16469 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 16470 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 16471 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 16472 | if (!spec->adc_nids) { |
| 16473 | spec->adc_nids = alc861vd_adc_nids; |
| 16474 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 16475 | } |
| 16476 | if (!spec->capsrc_nids) |
| 16477 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16478 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16479 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16480 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16481 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16482 | spec->vmaster_nid = 0x02; |
| 16483 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16484 | if (board_config == ALC861VD_AUTO) |
| 16485 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); |
| 16486 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16487 | codec->patch_ops = alc_patch_ops; |
| 16488 | |
| 16489 | if (board_config == ALC861VD_AUTO) |
| 16490 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16491 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16492 | if (!spec->loopback.amplist) |
| 16493 | spec->loopback.amplist = alc861vd_loopbacks; |
| 16494 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16495 | |
| 16496 | return 0; |
| 16497 | } |
| 16498 | |
| 16499 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16500 | * ALC662 support |
| 16501 | * |
| 16502 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 16503 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 16504 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 16505 | * 6-channel independent captures. |
| 16506 | * |
| 16507 | * In addition, an independent DAC for the multi-playback (not used in this |
| 16508 | * driver yet). |
| 16509 | */ |
| 16510 | #define ALC662_DIGOUT_NID 0x06 |
| 16511 | #define ALC662_DIGIN_NID 0x0a |
| 16512 | |
| 16513 | static hda_nid_t alc662_dac_nids[4] = { |
| 16514 | /* front, rear, clfe, rear_surr */ |
| 16515 | 0x02, 0x03, 0x04 |
| 16516 | }; |
| 16517 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16518 | static hda_nid_t alc272_dac_nids[2] = { |
| 16519 | 0x02, 0x03 |
| 16520 | }; |
| 16521 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16522 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16523 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16524 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16525 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16526 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16527 | static hda_nid_t alc272_adc_nids[1] = { |
| 16528 | /* ADC1-2 */ |
| 16529 | 0x08, |
| 16530 | }; |
| 16531 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16532 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16533 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 16534 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16535 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16536 | /* input MUX */ |
| 16537 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16538 | static struct hda_input_mux alc662_capture_source = { |
| 16539 | .num_items = 4, |
| 16540 | .items = { |
| 16541 | { "Mic", 0x0 }, |
| 16542 | { "Front Mic", 0x1 }, |
| 16543 | { "Line", 0x2 }, |
| 16544 | { "CD", 0x4 }, |
| 16545 | }, |
| 16546 | }; |
| 16547 | |
| 16548 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 16549 | .num_items = 2, |
| 16550 | .items = { |
| 16551 | { "Mic", 0x1 }, |
| 16552 | { "Line", 0x2 }, |
| 16553 | }, |
| 16554 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16555 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16556 | static struct hda_input_mux alc663_capture_source = { |
| 16557 | .num_items = 3, |
| 16558 | .items = { |
| 16559 | { "Mic", 0x0 }, |
| 16560 | { "Front Mic", 0x1 }, |
| 16561 | { "Line", 0x2 }, |
| 16562 | }, |
| 16563 | }; |
| 16564 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16565 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16566 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 16567 | .num_items = 16, |
| 16568 | .items = { |
| 16569 | { "Autoselect Mic", 0x0 }, |
| 16570 | { "Internal Mic", 0x1 }, |
| 16571 | { "In-0x02", 0x2 }, |
| 16572 | { "In-0x03", 0x3 }, |
| 16573 | { "In-0x04", 0x4 }, |
| 16574 | { "In-0x05", 0x5 }, |
| 16575 | { "In-0x06", 0x6 }, |
| 16576 | { "In-0x07", 0x7 }, |
| 16577 | { "In-0x08", 0x8 }, |
| 16578 | { "In-0x09", 0x9 }, |
| 16579 | { "In-0x0a", 0x0a }, |
| 16580 | { "In-0x0b", 0x0b }, |
| 16581 | { "In-0x0c", 0x0c }, |
| 16582 | { "In-0x0d", 0x0d }, |
| 16583 | { "In-0x0e", 0x0e }, |
| 16584 | { "In-0x0f", 0x0f }, |
| 16585 | }, |
| 16586 | }; |
| 16587 | #endif |
| 16588 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16589 | /* |
| 16590 | * 2ch mode |
| 16591 | */ |
| 16592 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 16593 | { 2, NULL } |
| 16594 | }; |
| 16595 | |
| 16596 | /* |
| 16597 | * 2ch mode |
| 16598 | */ |
| 16599 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 16600 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 16601 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 16602 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 16603 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 16604 | { } /* end */ |
| 16605 | }; |
| 16606 | |
| 16607 | /* |
| 16608 | * 6ch mode |
| 16609 | */ |
| 16610 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 16611 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16612 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 16613 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 16614 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16615 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 16616 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 16617 | { } /* end */ |
| 16618 | }; |
| 16619 | |
| 16620 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 16621 | { 2, alc662_3ST_ch2_init }, |
| 16622 | { 6, alc662_3ST_ch6_init }, |
| 16623 | }; |
| 16624 | |
| 16625 | /* |
| 16626 | * 2ch mode |
| 16627 | */ |
| 16628 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 16629 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16630 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16631 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16632 | { } /* end */ |
| 16633 | }; |
| 16634 | |
| 16635 | /* |
| 16636 | * 6ch mode |
| 16637 | */ |
| 16638 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 16639 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16640 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16641 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16642 | { } /* end */ |
| 16643 | }; |
| 16644 | |
| 16645 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 16646 | { 2, alc662_sixstack_ch6_init }, |
| 16647 | { 6, alc662_sixstack_ch8_init }, |
| 16648 | }; |
| 16649 | |
| 16650 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16651 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16652 | */ |
| 16653 | |
| 16654 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 16655 | /* output mixer control */ |
| 16656 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16657 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16658 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16659 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16660 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16661 | 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] | 16662 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16663 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16664 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16665 | |
| 16666 | /*Input mixer control */ |
| 16667 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 16668 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 16669 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 16670 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 16671 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 16672 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 16673 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 16674 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16675 | { } /* end */ |
| 16676 | }; |
| 16677 | |
| 16678 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 16679 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16680 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16681 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16682 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16683 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16684 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16685 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16686 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16687 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16688 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16689 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16690 | { } /* end */ |
| 16691 | }; |
| 16692 | |
| 16693 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 16694 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16695 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16696 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16697 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16698 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16699 | 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] | 16700 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16701 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16702 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16703 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16704 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16705 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16706 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16707 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16708 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16709 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16710 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16711 | { } /* end */ |
| 16712 | }; |
| 16713 | |
| 16714 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 16715 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16716 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 16717 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16718 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16719 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16720 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16721 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16722 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16723 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16724 | { } /* end */ |
| 16725 | }; |
| 16726 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16727 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16728 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16729 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16730 | |
| 16731 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 16732 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16733 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16734 | |
| 16735 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16736 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16737 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16738 | { } /* end */ |
| 16739 | }; |
| 16740 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16741 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16742 | ALC262_HIPPO_MASTER_SWITCH, |
| 16743 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16744 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16745 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16746 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16747 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16748 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16749 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16750 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16751 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16752 | { } /* end */ |
| 16753 | }; |
| 16754 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16755 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 16756 | .ops = &snd_hda_bind_vol, |
| 16757 | .values = { |
| 16758 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 16759 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 16760 | 0 |
| 16761 | }, |
| 16762 | }; |
| 16763 | |
| 16764 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 16765 | .ops = &snd_hda_bind_sw, |
| 16766 | .values = { |
| 16767 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16768 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16769 | 0 |
| 16770 | }, |
| 16771 | }; |
| 16772 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16773 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16774 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16775 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 16776 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16777 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16778 | { } /* end */ |
| 16779 | }; |
| 16780 | |
| 16781 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 16782 | .ops = &snd_hda_bind_sw, |
| 16783 | .values = { |
| 16784 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16785 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16786 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16787 | 0 |
| 16788 | }, |
| 16789 | }; |
| 16790 | |
| 16791 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 16792 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16793 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 16794 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16795 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16796 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16797 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16798 | |
| 16799 | { } /* end */ |
| 16800 | }; |
| 16801 | |
| 16802 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 16803 | .ops = &snd_hda_bind_sw, |
| 16804 | .values = { |
| 16805 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16806 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16807 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16808 | 0 |
| 16809 | }, |
| 16810 | }; |
| 16811 | |
| 16812 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 16813 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16814 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 16815 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16816 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16817 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16818 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16819 | { } /* end */ |
| 16820 | }; |
| 16821 | |
| 16822 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16823 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16824 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16825 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16826 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16827 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16828 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16829 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16830 | { } /* end */ |
| 16831 | }; |
| 16832 | |
| 16833 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 16834 | .ops = &snd_hda_bind_vol, |
| 16835 | .values = { |
| 16836 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 16837 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 16838 | 0 |
| 16839 | }, |
| 16840 | }; |
| 16841 | |
| 16842 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 16843 | .ops = &snd_hda_bind_sw, |
| 16844 | .values = { |
| 16845 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16846 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 16847 | 0 |
| 16848 | }, |
| 16849 | }; |
| 16850 | |
| 16851 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 16852 | HDA_BIND_VOL("Master Playback Volume", |
| 16853 | &alc663_asus_two_bind_master_vol), |
| 16854 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 16855 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16856 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16857 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16858 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16859 | { } /* end */ |
| 16860 | }; |
| 16861 | |
| 16862 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 16863 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16864 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 16865 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16866 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16867 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16868 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16869 | { } /* end */ |
| 16870 | }; |
| 16871 | |
| 16872 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 16873 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16874 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16875 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16876 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16877 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16878 | |
| 16879 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16880 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16881 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16882 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16883 | { } /* end */ |
| 16884 | }; |
| 16885 | |
| 16886 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 16887 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16888 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16889 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16890 | |
| 16891 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16892 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16893 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16894 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16895 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16896 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16897 | { } /* end */ |
| 16898 | }; |
| 16899 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16900 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 16901 | .ops = &snd_hda_bind_sw, |
| 16902 | .values = { |
| 16903 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16904 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16905 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 16906 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16907 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16908 | 0 |
| 16909 | }, |
| 16910 | }; |
| 16911 | |
| 16912 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 16913 | .ops = &snd_hda_bind_sw, |
| 16914 | .values = { |
| 16915 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16916 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 16917 | 0 |
| 16918 | }, |
| 16919 | }; |
| 16920 | |
| 16921 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 16922 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 16923 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 16924 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 16925 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16926 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16927 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16928 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16929 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16930 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16931 | { } /* end */ |
| 16932 | }; |
| 16933 | |
| 16934 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 16935 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 16936 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 16937 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 16938 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16939 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16940 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16941 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16942 | { } /* end */ |
| 16943 | }; |
| 16944 | |
| 16945 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16946 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 16947 | { |
| 16948 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16949 | .name = "Channel Mode", |
| 16950 | .info = alc_ch_mode_info, |
| 16951 | .get = alc_ch_mode_get, |
| 16952 | .put = alc_ch_mode_put, |
| 16953 | }, |
| 16954 | { } /* end */ |
| 16955 | }; |
| 16956 | |
| 16957 | static struct hda_verb alc662_init_verbs[] = { |
| 16958 | /* ADC: mute amp left and right */ |
| 16959 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16960 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16961 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16962 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16963 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16964 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16965 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16966 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16967 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16968 | |
| 16969 | /* Front Pin: output 0 (0x0c) */ |
| 16970 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16971 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16972 | |
| 16973 | /* Rear Pin: output 1 (0x0d) */ |
| 16974 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16975 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16976 | |
| 16977 | /* CLFE Pin: output 2 (0x0e) */ |
| 16978 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16979 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16980 | |
| 16981 | /* Mic (rear) pin: input vref at 80% */ |
| 16982 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16983 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16984 | /* Front Mic pin: input vref at 80% */ |
| 16985 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16986 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16987 | /* Line In pin: input */ |
| 16988 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16989 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16990 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16991 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16992 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16993 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16994 | /* CD pin widget for input */ |
| 16995 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16996 | |
| 16997 | /* FIXME: use matrix-type input source selection */ |
| 16998 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16999 | /* Input mixer */ |
| 17000 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17001 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17002 | |
| 17003 | /* always trun on EAPD */ |
| 17004 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17005 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17006 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17007 | { } |
| 17008 | }; |
| 17009 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17010 | static struct hda_verb alc663_init_verbs[] = { |
| 17011 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17012 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17013 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17014 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17015 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17016 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17017 | { } |
| 17018 | }; |
| 17019 | |
| 17020 | static struct hda_verb alc272_init_verbs[] = { |
| 17021 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17022 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17023 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17024 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17025 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17026 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17027 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17028 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17029 | { } |
| 17030 | }; |
| 17031 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17032 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17033 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17034 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17035 | {} |
| 17036 | }; |
| 17037 | |
| 17038 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17039 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17040 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17041 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17042 | }; |
| 17043 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17044 | /* Set Unsolicited Event*/ |
| 17045 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17046 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17047 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17048 | {} |
| 17049 | }; |
| 17050 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17051 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17052 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17053 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17054 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17055 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17056 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17057 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17058 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17059 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17060 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17061 | {} |
| 17062 | }; |
| 17063 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17064 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17065 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17066 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17067 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17068 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17069 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17070 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17071 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17072 | {} |
| 17073 | }; |
| 17074 | |
| 17075 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17076 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17077 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17078 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17079 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17080 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17081 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17082 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17083 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17084 | {} |
| 17085 | }; |
| 17086 | |
| 17087 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17088 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17089 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17090 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17091 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17092 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17093 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17094 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17095 | {} |
| 17096 | }; |
| 17097 | |
| 17098 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17099 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17100 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17101 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17102 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17103 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17104 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17105 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17106 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17107 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17108 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17109 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17110 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17111 | {} |
| 17112 | }; |
| 17113 | |
| 17114 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 17115 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17116 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17117 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17118 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17119 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17120 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17121 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17122 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17123 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17124 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17125 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17126 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17127 | {} |
| 17128 | }; |
| 17129 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17130 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 17131 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17132 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 17133 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 17134 | |
| 17135 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17136 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17137 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17138 | |
| 17139 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17140 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17141 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 17142 | {} |
| 17143 | }; |
| 17144 | |
| 17145 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 17146 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17147 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17148 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17149 | |
| 17150 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17151 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17152 | {} |
| 17153 | }; |
| 17154 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17155 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 17156 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 17157 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17158 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17159 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17160 | {} |
| 17161 | }; |
| 17162 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17163 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 17164 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17165 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17166 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17167 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17168 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17169 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17170 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17171 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17172 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17173 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17174 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17175 | {} |
| 17176 | }; |
| 17177 | |
| 17178 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 17179 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17180 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17181 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17182 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17183 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17184 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17185 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17186 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17187 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17188 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17189 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17190 | {} |
| 17191 | }; |
| 17192 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17193 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 17194 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17195 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17196 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17197 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17198 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17199 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17200 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17201 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17202 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17203 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17204 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17205 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17206 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17207 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17208 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17209 | {} |
| 17210 | }; |
| 17211 | |
| 17212 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 17213 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17214 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17215 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17216 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17217 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17218 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17219 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17220 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17221 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17222 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17223 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17224 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17225 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17226 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17227 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17228 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17229 | {} |
| 17230 | }; |
| 17231 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17232 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 17233 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 17234 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 17235 | { } /* end */ |
| 17236 | }; |
| 17237 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17238 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 17239 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 17240 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 17241 | { } /* end */ |
| 17242 | }; |
| 17243 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17244 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 17245 | { |
| 17246 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17247 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17248 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17249 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17250 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17251 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17252 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17253 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17254 | } |
| 17255 | |
| 17256 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 17257 | { |
| 17258 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17259 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17260 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17261 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17262 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17263 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17264 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17265 | HDA_AMP_MUTE, bits); |
| 17266 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17267 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17268 | } |
| 17269 | |
| 17270 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 17271 | unsigned int res) |
| 17272 | { |
| 17273 | if ((res >> 26) == ALC880_HP_EVENT) |
| 17274 | alc662_lenovo_101e_all_automute(codec); |
| 17275 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 17276 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 17277 | } |
| 17278 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17279 | /* unsolicited event for HP jack sensing */ |
| 17280 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 17281 | unsigned int res) |
| 17282 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17283 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17284 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17285 | else |
| 17286 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17287 | } |
| 17288 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17289 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17290 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17291 | struct alc_spec *spec = codec->spec; |
| 17292 | |
| 17293 | alc262_hippo1_setup(codec); |
| 17294 | spec->ext_mic.pin = 0x18; |
| 17295 | spec->ext_mic.mux_idx = 0; |
| 17296 | spec->int_mic.pin = 0x19; |
| 17297 | spec->int_mic.mux_idx = 1; |
| 17298 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17299 | } |
| 17300 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17301 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 17302 | { |
| 17303 | alc262_hippo_automute(codec); |
| 17304 | alc_mic_automute(codec); |
| 17305 | } |
| 17306 | |
| 17307 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17308 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17309 | struct alc_spec *spec = codec->spec; |
| 17310 | |
| 17311 | spec->autocfg.hp_pins[0] = 0x14; |
| 17312 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17313 | } |
| 17314 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17315 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 17316 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17317 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 17318 | { |
| 17319 | unsigned int present; |
| 17320 | unsigned char bits; |
| 17321 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17322 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17323 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17324 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17325 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17326 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17327 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17328 | } |
| 17329 | |
| 17330 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 17331 | { |
| 17332 | unsigned int present; |
| 17333 | unsigned char bits; |
| 17334 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17335 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17336 | bits = present ? HDA_AMP_MUTE : 0; |
| 17337 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17338 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17339 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17340 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17341 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17342 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17343 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17344 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17345 | } |
| 17346 | |
| 17347 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 17348 | { |
| 17349 | unsigned int present; |
| 17350 | unsigned char bits; |
| 17351 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17352 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17353 | bits = present ? HDA_AMP_MUTE : 0; |
| 17354 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17355 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17356 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17357 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17358 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17359 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17360 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17361 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17362 | } |
| 17363 | |
| 17364 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 17365 | { |
| 17366 | unsigned int present; |
| 17367 | unsigned char bits; |
| 17368 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17369 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17370 | bits = present ? 0 : PIN_OUT; |
| 17371 | snd_hda_codec_write(codec, 0x14, 0, |
| 17372 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 17373 | } |
| 17374 | |
| 17375 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 17376 | { |
| 17377 | unsigned int present1, present2; |
| 17378 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17379 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 17380 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17381 | |
| 17382 | if (present1 || present2) { |
| 17383 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17384 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17385 | } else { |
| 17386 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17387 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17388 | } |
| 17389 | } |
| 17390 | |
| 17391 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 17392 | { |
| 17393 | unsigned int present1, present2; |
| 17394 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17395 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 17396 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17397 | |
| 17398 | if (present1 || present2) { |
| 17399 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17400 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17401 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17402 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17403 | } else { |
| 17404 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17405 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17406 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17407 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17408 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17409 | } |
| 17410 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17411 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 17412 | { |
| 17413 | unsigned int present1, present2; |
| 17414 | |
| 17415 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 17416 | AC_VERB_GET_PIN_SENSE, 0) |
| 17417 | & AC_PINSENSE_PRESENCE; |
| 17418 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 17419 | AC_VERB_GET_PIN_SENSE, 0) |
| 17420 | & AC_PINSENSE_PRESENCE; |
| 17421 | |
| 17422 | if (present1 || present2) { |
| 17423 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17424 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17425 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17426 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17427 | } else { |
| 17428 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17429 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17430 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17431 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17432 | } |
| 17433 | } |
| 17434 | |
| 17435 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 17436 | { |
| 17437 | unsigned int present1, present2; |
| 17438 | |
| 17439 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 17440 | AC_VERB_GET_PIN_SENSE, 0) |
| 17441 | & AC_PINSENSE_PRESENCE; |
| 17442 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 17443 | AC_VERB_GET_PIN_SENSE, 0) |
| 17444 | & AC_PINSENSE_PRESENCE; |
| 17445 | |
| 17446 | if (present1 || present2) { |
| 17447 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17448 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17449 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17450 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17451 | } else { |
| 17452 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17453 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17454 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17455 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17456 | } |
| 17457 | } |
| 17458 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17459 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 17460 | unsigned int res) |
| 17461 | { |
| 17462 | switch (res >> 26) { |
| 17463 | case ALC880_HP_EVENT: |
| 17464 | alc663_m51va_speaker_automute(codec); |
| 17465 | break; |
| 17466 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17467 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17468 | break; |
| 17469 | } |
| 17470 | } |
| 17471 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17472 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 17473 | { |
| 17474 | struct alc_spec *spec = codec->spec; |
| 17475 | spec->ext_mic.pin = 0x18; |
| 17476 | spec->ext_mic.mux_idx = 0; |
| 17477 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17478 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17479 | spec->auto_mic = 1; |
| 17480 | } |
| 17481 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17482 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 17483 | { |
| 17484 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17485 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17486 | } |
| 17487 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17488 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17489 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17490 | |
| 17491 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 17492 | { |
| 17493 | struct alc_spec *spec = codec->spec; |
| 17494 | spec->ext_mic.pin = 0x18; |
| 17495 | spec->ext_mic.mux_idx = 0; |
| 17496 | spec->int_mic.pin = 0x19; |
| 17497 | spec->int_mic.mux_idx = 1; |
| 17498 | spec->auto_mic = 1; |
| 17499 | } |
| 17500 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17501 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17502 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17503 | /* ***************** Mode2 ******************************/ |
| 17504 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 17505 | unsigned int res) |
| 17506 | { |
| 17507 | switch (res >> 26) { |
| 17508 | case ALC880_HP_EVENT: |
| 17509 | alc662_f5z_speaker_automute(codec); |
| 17510 | break; |
| 17511 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17512 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17513 | break; |
| 17514 | } |
| 17515 | } |
| 17516 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17517 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17518 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17519 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 17520 | { |
| 17521 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17522 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17523 | } |
| 17524 | /* ***************** Mode3 ******************************/ |
| 17525 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 17526 | unsigned int res) |
| 17527 | { |
| 17528 | switch (res >> 26) { |
| 17529 | case ALC880_HP_EVENT: |
| 17530 | alc663_two_hp_m1_speaker_automute(codec); |
| 17531 | break; |
| 17532 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17533 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17534 | break; |
| 17535 | } |
| 17536 | } |
| 17537 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17538 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17539 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17540 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 17541 | { |
| 17542 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17543 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17544 | } |
| 17545 | /* ***************** Mode4 ******************************/ |
| 17546 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 17547 | unsigned int res) |
| 17548 | { |
| 17549 | switch (res >> 26) { |
| 17550 | case ALC880_HP_EVENT: |
| 17551 | alc663_21jd_two_speaker_automute(codec); |
| 17552 | break; |
| 17553 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17554 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17555 | break; |
| 17556 | } |
| 17557 | } |
| 17558 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17559 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17560 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17561 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 17562 | { |
| 17563 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17564 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17565 | } |
| 17566 | /* ***************** Mode5 ******************************/ |
| 17567 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 17568 | unsigned int res) |
| 17569 | { |
| 17570 | switch (res >> 26) { |
| 17571 | case ALC880_HP_EVENT: |
| 17572 | alc663_15jd_two_speaker_automute(codec); |
| 17573 | break; |
| 17574 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17575 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17576 | break; |
| 17577 | } |
| 17578 | } |
| 17579 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17580 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17581 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17582 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 17583 | { |
| 17584 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17585 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17586 | } |
| 17587 | /* ***************** Mode6 ******************************/ |
| 17588 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 17589 | unsigned int res) |
| 17590 | { |
| 17591 | switch (res >> 26) { |
| 17592 | case ALC880_HP_EVENT: |
| 17593 | alc663_two_hp_m2_speaker_automute(codec); |
| 17594 | break; |
| 17595 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17596 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17597 | break; |
| 17598 | } |
| 17599 | } |
| 17600 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17601 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17602 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17603 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 17604 | { |
| 17605 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17606 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17607 | } |
| 17608 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17609 | /* ***************** Mode7 ******************************/ |
| 17610 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 17611 | unsigned int res) |
| 17612 | { |
| 17613 | switch (res >> 26) { |
| 17614 | case ALC880_HP_EVENT: |
| 17615 | alc663_two_hp_m7_speaker_automute(codec); |
| 17616 | break; |
| 17617 | case ALC880_MIC_EVENT: |
| 17618 | alc_mic_automute(codec); |
| 17619 | break; |
| 17620 | } |
| 17621 | } |
| 17622 | |
| 17623 | #define alc663_mode7_setup alc663_mode1_setup |
| 17624 | |
| 17625 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 17626 | { |
| 17627 | alc663_two_hp_m7_speaker_automute(codec); |
| 17628 | alc_mic_automute(codec); |
| 17629 | } |
| 17630 | |
| 17631 | /* ***************** Mode8 ******************************/ |
| 17632 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 17633 | unsigned int res) |
| 17634 | { |
| 17635 | switch (res >> 26) { |
| 17636 | case ALC880_HP_EVENT: |
| 17637 | alc663_two_hp_m8_speaker_automute(codec); |
| 17638 | break; |
| 17639 | case ALC880_MIC_EVENT: |
| 17640 | alc_mic_automute(codec); |
| 17641 | break; |
| 17642 | } |
| 17643 | } |
| 17644 | |
| 17645 | #define alc663_mode8_setup alc663_m51va_setup |
| 17646 | |
| 17647 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 17648 | { |
| 17649 | alc663_two_hp_m8_speaker_automute(codec); |
| 17650 | alc_mic_automute(codec); |
| 17651 | } |
| 17652 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17653 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 17654 | { |
| 17655 | unsigned int present; |
| 17656 | unsigned char bits; |
| 17657 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17658 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17659 | bits = present ? HDA_AMP_MUTE : 0; |
| 17660 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17661 | HDA_AMP_MUTE, bits); |
| 17662 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17663 | HDA_AMP_MUTE, bits); |
| 17664 | } |
| 17665 | |
| 17666 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 17667 | { |
| 17668 | unsigned int present; |
| 17669 | unsigned char bits; |
| 17670 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17671 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17672 | bits = present ? HDA_AMP_MUTE : 0; |
| 17673 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17674 | HDA_AMP_MUTE, bits); |
| 17675 | } |
| 17676 | |
| 17677 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 17678 | unsigned int res) |
| 17679 | { |
| 17680 | switch (res >> 26) { |
| 17681 | case ALC880_HP_EVENT: |
| 17682 | alc663_g71v_hp_automute(codec); |
| 17683 | break; |
| 17684 | case ALC880_FRONT_EVENT: |
| 17685 | alc663_g71v_front_automute(codec); |
| 17686 | break; |
| 17687 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17688 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17689 | break; |
| 17690 | } |
| 17691 | } |
| 17692 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17693 | #define alc663_g71v_setup alc663_m51va_setup |
| 17694 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17695 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 17696 | { |
| 17697 | alc663_g71v_front_automute(codec); |
| 17698 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17699 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17700 | } |
| 17701 | |
| 17702 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 17703 | unsigned int res) |
| 17704 | { |
| 17705 | switch (res >> 26) { |
| 17706 | case ALC880_HP_EVENT: |
| 17707 | alc663_m51va_speaker_automute(codec); |
| 17708 | break; |
| 17709 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17710 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17711 | break; |
| 17712 | } |
| 17713 | } |
| 17714 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17715 | #define alc663_g50v_setup alc663_m51va_setup |
| 17716 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17717 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 17718 | { |
| 17719 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17720 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17721 | } |
| 17722 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17723 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 17724 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17725 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17726 | |
| 17727 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 17728 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17729 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17730 | |
| 17731 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17732 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17733 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17734 | { } /* end */ |
| 17735 | }; |
| 17736 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17737 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 17738 | /* Master Playback automatically created from Speaker and Headphone */ |
| 17739 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17740 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17741 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17742 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17743 | |
| 17744 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17745 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17746 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 17747 | |
| 17748 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17749 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17750 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 17751 | { } /* end */ |
| 17752 | }; |
| 17753 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17754 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17755 | #define alc662_loopbacks alc880_loopbacks |
| 17756 | #endif |
| 17757 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17758 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17759 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17760 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 17761 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 17762 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 17763 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 17764 | |
| 17765 | /* |
| 17766 | * configuration and preset |
| 17767 | */ |
| 17768 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 17769 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 17770 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 17771 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 17772 | [ALC662_5ST_DIG] = "6stack-dig", |
| 17773 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 17774 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17775 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17776 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17777 | [ALC663_ASUS_M51VA] = "m51va", |
| 17778 | [ALC663_ASUS_G71V] = "g71v", |
| 17779 | [ALC663_ASUS_H13] = "h13", |
| 17780 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17781 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 17782 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 17783 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 17784 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 17785 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 17786 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17787 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 17788 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 17789 | [ALC272_DELL] = "dell", |
| 17790 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17791 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17792 | [ALC662_AUTO] = "auto", |
| 17793 | }; |
| 17794 | |
| 17795 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17796 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17797 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 17798 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17799 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 17800 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17801 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17802 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 17803 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 17804 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 17805 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17806 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 17807 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17808 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17809 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 17810 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 17811 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 17812 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 17813 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17814 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17815 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 17816 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17817 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 17818 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 17819 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 17820 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17821 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17822 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 17823 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 17824 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17825 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 17826 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 17827 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 17828 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17829 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17830 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 17831 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17832 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17833 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 17834 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 17835 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17836 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17837 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17838 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 17839 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17840 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 17841 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 17842 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17843 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17844 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 17845 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17846 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17847 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 17848 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17849 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 17850 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 17851 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17852 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17853 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 17854 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 17855 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17856 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17857 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17858 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 17859 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 17860 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 17861 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17862 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 17863 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 17864 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17865 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 17866 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 17867 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17868 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 17869 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 17870 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17871 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 17872 | ALC663_ASUS_H13), |
David Santinoli | 7aee674 | 2009-12-09 12:34:26 +0100 | [diff] [blame] | 17873 | SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17874 | {} |
| 17875 | }; |
| 17876 | |
| 17877 | static struct alc_config_preset alc662_presets[] = { |
| 17878 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17879 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17880 | .init_verbs = { alc662_init_verbs }, |
| 17881 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17882 | .dac_nids = alc662_dac_nids, |
| 17883 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17884 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17885 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17886 | .channel_mode = alc662_3ST_2ch_modes, |
| 17887 | .input_mux = &alc662_capture_source, |
| 17888 | }, |
| 17889 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17890 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17891 | .init_verbs = { alc662_init_verbs }, |
| 17892 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17893 | .dac_nids = alc662_dac_nids, |
| 17894 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17895 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17896 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17897 | .channel_mode = alc662_3ST_6ch_modes, |
| 17898 | .need_dac_fix = 1, |
| 17899 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17900 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17901 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17902 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17903 | .init_verbs = { alc662_init_verbs }, |
| 17904 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17905 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17906 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17907 | .channel_mode = alc662_3ST_6ch_modes, |
| 17908 | .need_dac_fix = 1, |
| 17909 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17910 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17911 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17912 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17913 | .init_verbs = { alc662_init_verbs }, |
| 17914 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17915 | .dac_nids = alc662_dac_nids, |
| 17916 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17917 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17918 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 17919 | .channel_mode = alc662_5stack_modes, |
| 17920 | .input_mux = &alc662_capture_source, |
| 17921 | }, |
| 17922 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17923 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17924 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 17925 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17926 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17927 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17928 | .channel_mode = alc662_3ST_2ch_modes, |
| 17929 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 17930 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 17931 | .init_hook = alc662_lenovo_101e_all_automute, |
| 17932 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17933 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17934 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17935 | .init_verbs = { alc662_init_verbs, |
| 17936 | alc662_eeepc_sue_init_verbs }, |
| 17937 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17938 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17939 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17940 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17941 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17942 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17943 | .init_hook = alc662_eeepc_inithook, |
| 17944 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17945 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17946 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17947 | alc662_chmode_mixer }, |
| 17948 | .init_verbs = { alc662_init_verbs, |
| 17949 | alc662_eeepc_ep20_sue_init_verbs }, |
| 17950 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17951 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17952 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17953 | .channel_mode = alc662_3ST_6ch_modes, |
| 17954 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17955 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17956 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17957 | .init_hook = alc662_eeepc_ep20_inithook, |
| 17958 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17959 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17960 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17961 | .init_verbs = { alc662_init_verbs, |
| 17962 | alc662_ecs_init_verbs }, |
| 17963 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17964 | .dac_nids = alc662_dac_nids, |
| 17965 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17966 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17967 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17968 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17969 | .init_hook = alc662_eeepc_inithook, |
| 17970 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17971 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17972 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17973 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 17974 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17975 | .dac_nids = alc662_dac_nids, |
| 17976 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17977 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17978 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17979 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17980 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17981 | .init_hook = alc663_m51va_inithook, |
| 17982 | }, |
| 17983 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17984 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17985 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 17986 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17987 | .dac_nids = alc662_dac_nids, |
| 17988 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17989 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17990 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17991 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17992 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17993 | .init_hook = alc663_g71v_inithook, |
| 17994 | }, |
| 17995 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17996 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17997 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 17998 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17999 | .dac_nids = alc662_dac_nids, |
| 18000 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18001 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18002 | .unsol_event = alc663_m51va_unsol_event, |
| 18003 | .init_hook = alc663_m51va_inithook, |
| 18004 | }, |
| 18005 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18006 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18007 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18008 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18009 | .dac_nids = alc662_dac_nids, |
| 18010 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18011 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18012 | .channel_mode = alc662_3ST_6ch_modes, |
| 18013 | .input_mux = &alc663_capture_source, |
| 18014 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18015 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18016 | .init_hook = alc663_g50v_inithook, |
| 18017 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18018 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18019 | .mixers = { alc663_m51va_mixer }, |
| 18020 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18021 | .init_verbs = { alc662_init_verbs, |
| 18022 | alc663_21jd_amic_init_verbs }, |
| 18023 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18024 | .hp_nid = 0x03, |
| 18025 | .dac_nids = alc662_dac_nids, |
| 18026 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18027 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18028 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18029 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18030 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18031 | .init_hook = alc663_mode1_inithook, |
| 18032 | }, |
| 18033 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18034 | .mixers = { alc662_1bjd_mixer }, |
| 18035 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18036 | .init_verbs = { alc662_init_verbs, |
| 18037 | alc662_1bjd_amic_init_verbs }, |
| 18038 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18039 | .dac_nids = alc662_dac_nids, |
| 18040 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18041 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18042 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18043 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18044 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18045 | .init_hook = alc662_mode2_inithook, |
| 18046 | }, |
| 18047 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18048 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18049 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18050 | .init_verbs = { alc662_init_verbs, |
| 18051 | alc663_two_hp_amic_m1_init_verbs }, |
| 18052 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18053 | .hp_nid = 0x03, |
| 18054 | .dac_nids = alc662_dac_nids, |
| 18055 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18056 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18057 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18058 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18059 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18060 | .init_hook = alc663_mode3_inithook, |
| 18061 | }, |
| 18062 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18063 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18064 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18065 | .init_verbs = { alc662_init_verbs, |
| 18066 | alc663_21jd_amic_init_verbs}, |
| 18067 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18068 | .hp_nid = 0x03, |
| 18069 | .dac_nids = alc662_dac_nids, |
| 18070 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18071 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18072 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18073 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18074 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18075 | .init_hook = alc663_mode4_inithook, |
| 18076 | }, |
| 18077 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18078 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18079 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18080 | .init_verbs = { alc662_init_verbs, |
| 18081 | alc663_15jd_amic_init_verbs }, |
| 18082 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18083 | .hp_nid = 0x03, |
| 18084 | .dac_nids = alc662_dac_nids, |
| 18085 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18086 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18087 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18088 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18089 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18090 | .init_hook = alc663_mode5_inithook, |
| 18091 | }, |
| 18092 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18093 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18094 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18095 | .init_verbs = { alc662_init_verbs, |
| 18096 | alc663_two_hp_amic_m2_init_verbs }, |
| 18097 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18098 | .hp_nid = 0x03, |
| 18099 | .dac_nids = alc662_dac_nids, |
| 18100 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18101 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18102 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18103 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18104 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18105 | .init_hook = alc663_mode6_inithook, |
| 18106 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18107 | [ALC663_ASUS_MODE7] = { |
| 18108 | .mixers = { alc663_mode7_mixer }, |
| 18109 | .cap_mixer = alc662_auto_capture_mixer, |
| 18110 | .init_verbs = { alc662_init_verbs, |
| 18111 | alc663_mode7_init_verbs }, |
| 18112 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18113 | .hp_nid = 0x03, |
| 18114 | .dac_nids = alc662_dac_nids, |
| 18115 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18116 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18117 | .channel_mode = alc662_3ST_2ch_modes, |
| 18118 | .unsol_event = alc663_mode7_unsol_event, |
| 18119 | .setup = alc663_mode7_setup, |
| 18120 | .init_hook = alc663_mode7_inithook, |
| 18121 | }, |
| 18122 | [ALC663_ASUS_MODE8] = { |
| 18123 | .mixers = { alc663_mode8_mixer }, |
| 18124 | .cap_mixer = alc662_auto_capture_mixer, |
| 18125 | .init_verbs = { alc662_init_verbs, |
| 18126 | alc663_mode8_init_verbs }, |
| 18127 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18128 | .hp_nid = 0x03, |
| 18129 | .dac_nids = alc662_dac_nids, |
| 18130 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18131 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18132 | .channel_mode = alc662_3ST_2ch_modes, |
| 18133 | .unsol_event = alc663_mode8_unsol_event, |
| 18134 | .setup = alc663_mode8_setup, |
| 18135 | .init_hook = alc663_mode8_inithook, |
| 18136 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18137 | [ALC272_DELL] = { |
| 18138 | .mixers = { alc663_m51va_mixer }, |
| 18139 | .cap_mixer = alc272_auto_capture_mixer, |
| 18140 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 18141 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18142 | .dac_nids = alc662_dac_nids, |
| 18143 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18144 | .adc_nids = alc272_adc_nids, |
| 18145 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18146 | .capsrc_nids = alc272_capsrc_nids, |
| 18147 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18148 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18149 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18150 | .init_hook = alc663_m51va_inithook, |
| 18151 | }, |
| 18152 | [ALC272_DELL_ZM1] = { |
| 18153 | .mixers = { alc663_m51va_mixer }, |
| 18154 | .cap_mixer = alc662_auto_capture_mixer, |
| 18155 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 18156 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18157 | .dac_nids = alc662_dac_nids, |
| 18158 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18159 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18160 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18161 | .capsrc_nids = alc662_capsrc_nids, |
| 18162 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18163 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18164 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18165 | .init_hook = alc663_m51va_inithook, |
| 18166 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18167 | [ALC272_SAMSUNG_NC10] = { |
| 18168 | .mixers = { alc272_nc10_mixer }, |
| 18169 | .init_verbs = { alc662_init_verbs, |
| 18170 | alc663_21jd_amic_init_verbs }, |
| 18171 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18172 | .dac_nids = alc272_dac_nids, |
| 18173 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18174 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18175 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18176 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18177 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18178 | .init_hook = alc663_mode4_inithook, |
| 18179 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18180 | }; |
| 18181 | |
| 18182 | |
| 18183 | /* |
| 18184 | * BIOS auto configuration |
| 18185 | */ |
| 18186 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18187 | /* convert from MIX nid to DAC */ |
| 18188 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 18189 | { |
| 18190 | if (nid == 0x0f) |
| 18191 | return 0x02; |
| 18192 | else if (nid >= 0x0c && nid <= 0x0e) |
| 18193 | return nid - 0x0c + 0x02; |
| 18194 | else |
| 18195 | return 0; |
| 18196 | } |
| 18197 | |
| 18198 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 18199 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 18200 | hda_nid_t dac) |
| 18201 | { |
| 18202 | hda_nid_t mix[4]; |
| 18203 | int i, num; |
| 18204 | |
| 18205 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18206 | for (i = 0; i < num; i++) { |
| 18207 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 18208 | return mix[i]; |
| 18209 | } |
| 18210 | return 0; |
| 18211 | } |
| 18212 | |
| 18213 | /* look for an empty DAC slot */ |
| 18214 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 18215 | { |
| 18216 | struct alc_spec *spec = codec->spec; |
| 18217 | hda_nid_t srcs[5]; |
| 18218 | int i, j, num; |
| 18219 | |
| 18220 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 18221 | if (num < 0) |
| 18222 | return 0; |
| 18223 | for (i = 0; i < num; i++) { |
| 18224 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 18225 | if (!nid) |
| 18226 | continue; |
| 18227 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 18228 | if (spec->multiout.dac_nids[j] == nid) |
| 18229 | break; |
| 18230 | if (j >= spec->multiout.num_dacs) |
| 18231 | return nid; |
| 18232 | } |
| 18233 | return 0; |
| 18234 | } |
| 18235 | |
| 18236 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 18237 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 18238 | const struct auto_pin_cfg *cfg) |
| 18239 | { |
| 18240 | struct alc_spec *spec = codec->spec; |
| 18241 | int i; |
| 18242 | hda_nid_t dac; |
| 18243 | |
| 18244 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 18245 | for (i = 0; i < cfg->line_outs; i++) { |
| 18246 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 18247 | if (!dac) |
| 18248 | continue; |
| 18249 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 18250 | } |
| 18251 | return 0; |
| 18252 | } |
| 18253 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18254 | 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] | 18255 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18256 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18257 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18258 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 18259 | } |
| 18260 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18261 | 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] | 18262 | hda_nid_t nid, unsigned int chs) |
| 18263 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18264 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18265 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 18266 | } |
| 18267 | |
| 18268 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 18269 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 18270 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 18271 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 18272 | |
| 18273 | /* add playback controls from the parsed DAC table */ |
| 18274 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 18275 | const struct auto_pin_cfg *cfg) |
| 18276 | { |
| 18277 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18278 | static const char *chname[4] = { |
| 18279 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 18280 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18281 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18282 | int i, err; |
| 18283 | |
| 18284 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18285 | nid = spec->multiout.dac_nids[i]; |
| 18286 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18287 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18288 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 18289 | if (!mix) |
| 18290 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18291 | if (i == 2) { |
| 18292 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18293 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18294 | if (err < 0) |
| 18295 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18296 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18297 | if (err < 0) |
| 18298 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18299 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18300 | if (err < 0) |
| 18301 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18302 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18303 | if (err < 0) |
| 18304 | return err; |
| 18305 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18306 | const char *pfx; |
| 18307 | if (cfg->line_outs == 1 && |
| 18308 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18309 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18310 | pfx = "Speaker"; |
| 18311 | else |
| 18312 | pfx = "PCM"; |
| 18313 | } else |
| 18314 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18315 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18316 | if (err < 0) |
| 18317 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18318 | if (cfg->line_outs == 1 && |
| 18319 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 18320 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18321 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18322 | if (err < 0) |
| 18323 | return err; |
| 18324 | } |
| 18325 | } |
| 18326 | return 0; |
| 18327 | } |
| 18328 | |
| 18329 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18330 | /* return DAC nid if any new DAC is assigned */ |
| 18331 | 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] | 18332 | const char *pfx) |
| 18333 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18334 | struct alc_spec *spec = codec->spec; |
| 18335 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18336 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18337 | |
| 18338 | if (!pin) |
| 18339 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18340 | nid = alc662_look_for_dac(codec, pin); |
| 18341 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18342 | /* the corresponding DAC is already occupied */ |
| 18343 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 18344 | return 0; /* no way */ |
| 18345 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18346 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18347 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 18348 | } |
| 18349 | |
| 18350 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 18351 | if (!mix) |
| 18352 | return 0; |
| 18353 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 18354 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 18355 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18356 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 18357 | if (err < 0) |
| 18358 | return err; |
| 18359 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18360 | } |
| 18361 | |
| 18362 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18363 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 18364 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18365 | |
| 18366 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 18367 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18368 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18369 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18370 | int i, num; |
| 18371 | hda_nid_t srcs[4]; |
| 18372 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18373 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18374 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18375 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 18376 | if (num <= 1) |
| 18377 | return; |
| 18378 | for (i = 0; i < num; i++) { |
| 18379 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 18380 | continue; |
| 18381 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 18382 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18383 | } |
| 18384 | } |
| 18385 | |
| 18386 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 18387 | { |
| 18388 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18389 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18390 | int i; |
| 18391 | |
| 18392 | for (i = 0; i <= HDA_SIDE; i++) { |
| 18393 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 18394 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 18395 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18396 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18397 | } |
| 18398 | } |
| 18399 | |
| 18400 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 18401 | { |
| 18402 | struct alc_spec *spec = codec->spec; |
| 18403 | hda_nid_t pin; |
| 18404 | |
| 18405 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18406 | if (pin) |
| 18407 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 18408 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18409 | pin = spec->autocfg.speaker_pins[0]; |
| 18410 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18411 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 18412 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18413 | } |
| 18414 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18415 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 18416 | |
| 18417 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 18418 | { |
| 18419 | struct alc_spec *spec = codec->spec; |
| 18420 | int i; |
| 18421 | |
| 18422 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 18423 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18424 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 18425 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 18426 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 18427 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18428 | snd_hda_codec_write(codec, nid, 0, |
| 18429 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 18430 | AMP_OUT_MUTE); |
| 18431 | } |
| 18432 | } |
| 18433 | } |
| 18434 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18435 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 18436 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18437 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 18438 | { |
| 18439 | struct alc_spec *spec = codec->spec; |
| 18440 | int err; |
| 18441 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 18442 | |
| 18443 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 18444 | alc662_ignore); |
| 18445 | if (err < 0) |
| 18446 | return err; |
| 18447 | if (!spec->autocfg.line_outs) |
| 18448 | return 0; /* can't find valid BIOS pin config */ |
| 18449 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18450 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18451 | if (err < 0) |
| 18452 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18453 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18454 | if (err < 0) |
| 18455 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18456 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18457 | spec->autocfg.speaker_pins[0], |
| 18458 | "Speaker"); |
| 18459 | if (err < 0) |
| 18460 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18461 | if (err) |
| 18462 | spec->multiout.extra_out_nid[0] = err; |
| 18463 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18464 | "Headphone"); |
| 18465 | if (err < 0) |
| 18466 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18467 | if (err) |
| 18468 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18469 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18470 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18471 | return err; |
| 18472 | |
| 18473 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 18474 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 18475 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18476 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 18477 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 18478 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 18479 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18480 | |
| 18481 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 18482 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 18483 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18484 | add_verb(spec, alc662_init_verbs); |
| 18485 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 18486 | codec->vendor_id == 0x10ec0665) |
| 18487 | add_verb(spec, alc663_init_verbs); |
| 18488 | |
| 18489 | if (codec->vendor_id == 0x10ec0272) |
| 18490 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 18491 | |
| 18492 | err = alc_auto_add_mic_boost(codec); |
| 18493 | if (err < 0) |
| 18494 | return err; |
| 18495 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18496 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 18497 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 18498 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 18499 | else |
| 18500 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 18501 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18502 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18503 | } |
| 18504 | |
| 18505 | /* additional initialization for auto-configuration model */ |
| 18506 | static void alc662_auto_init(struct hda_codec *codec) |
| 18507 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18508 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18509 | alc662_auto_init_multi_out(codec); |
| 18510 | alc662_auto_init_hp_out(codec); |
| 18511 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18512 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18513 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 18514 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18515 | } |
| 18516 | |
| 18517 | static int patch_alc662(struct hda_codec *codec) |
| 18518 | { |
| 18519 | struct alc_spec *spec; |
| 18520 | int err, board_config; |
| 18521 | |
| 18522 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 18523 | if (!spec) |
| 18524 | return -ENOMEM; |
| 18525 | |
| 18526 | codec->spec = spec; |
| 18527 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 18528 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 18529 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18530 | if (alc_read_coef_idx(codec, 0)==0x8020){ |
| 18531 | kfree(codec->chip_name); |
| 18532 | codec->chip_name = kstrdup("ALC661", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18533 | if (!codec->chip_name) { |
| 18534 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18535 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18536 | } |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18537 | } |
| 18538 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18539 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 18540 | alc662_models, |
| 18541 | alc662_cfg_tbl); |
| 18542 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 18543 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 18544 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18545 | board_config = ALC662_AUTO; |
| 18546 | } |
| 18547 | |
| 18548 | if (board_config == ALC662_AUTO) { |
| 18549 | /* automatic parse from the BIOS config */ |
| 18550 | err = alc662_parse_auto_config(codec); |
| 18551 | if (err < 0) { |
| 18552 | alc_free(codec); |
| 18553 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18554 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18555 | printk(KERN_INFO |
| 18556 | "hda_codec: Cannot set up configuration " |
| 18557 | "from BIOS. Using base mode...\n"); |
| 18558 | board_config = ALC662_3ST_2ch_DIG; |
| 18559 | } |
| 18560 | } |
| 18561 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 18562 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 18563 | if (err < 0) { |
| 18564 | alc_free(codec); |
| 18565 | return err; |
| 18566 | } |
| 18567 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18568 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 18569 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18570 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18571 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 18572 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 18573 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18574 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 18575 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 18576 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 18577 | if (!spec->adc_nids) { |
| 18578 | spec->adc_nids = alc662_adc_nids; |
| 18579 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 18580 | } |
| 18581 | if (!spec->capsrc_nids) |
| 18582 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18583 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18584 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18585 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18586 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18587 | switch (codec->vendor_id) { |
| 18588 | case 0x10ec0662: |
| 18589 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 18590 | break; |
| 18591 | case 0x10ec0272: |
| 18592 | case 0x10ec0663: |
| 18593 | case 0x10ec0665: |
| 18594 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 18595 | break; |
| 18596 | case 0x10ec0273: |
| 18597 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 18598 | break; |
| 18599 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 18600 | spec->vmaster_nid = 0x02; |
| 18601 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18602 | codec->patch_ops = alc_patch_ops; |
| 18603 | if (board_config == ALC662_AUTO) |
| 18604 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18605 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18606 | if (!spec->loopback.amplist) |
| 18607 | spec->loopback.amplist = alc662_loopbacks; |
| 18608 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18609 | |
| 18610 | return 0; |
| 18611 | } |
| 18612 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18613 | static int patch_alc888(struct hda_codec *codec) |
| 18614 | { |
| 18615 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 18616 | kfree(codec->chip_name); |
| 18617 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18618 | if (!codec->chip_name) { |
| 18619 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18620 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18621 | } |
| 18622 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18623 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18624 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18625 | } |
| 18626 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18627 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18628 | * patch entries |
| 18629 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 18630 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18631 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 18632 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 18633 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 18634 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 18635 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18636 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 18637 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18638 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18639 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18640 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18641 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 18642 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 18643 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18644 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18645 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18646 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 18647 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18648 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18649 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18650 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18651 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18652 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18653 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 18654 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18655 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 18656 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18657 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 18658 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18659 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 18660 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18661 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18662 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18663 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18664 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18665 | {} /* terminator */ |
| 18666 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 18667 | |
| 18668 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 18669 | |
| 18670 | MODULE_LICENSE("GPL"); |
| 18671 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 18672 | |
| 18673 | static struct hda_codec_preset_list realtek_list = { |
| 18674 | .preset = snd_hda_preset_realtek, |
| 18675 | .owner = THIS_MODULE, |
| 18676 | }; |
| 18677 | |
| 18678 | static int __init patch_realtek_init(void) |
| 18679 | { |
| 18680 | return snd_hda_add_codec_preset(&realtek_list); |
| 18681 | } |
| 18682 | |
| 18683 | static void __exit patch_realtek_exit(void) |
| 18684 | { |
| 18685 | snd_hda_delete_codec_preset(&realtek_list); |
| 18686 | } |
| 18687 | |
| 18688 | module_init(patch_realtek_init) |
| 18689 | module_exit(patch_realtek_exit) |