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 | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 140 | ALC271_ACER, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 141 | ALC269_AUTO, |
| 142 | ALC269_MODEL_LAST /* last tag */ |
| 143 | }; |
| 144 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 145 | /* ALC861 models */ |
| 146 | enum { |
| 147 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 148 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 149 | ALC861_3ST_DIG, |
| 150 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 151 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 152 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 153 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 154 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 155 | ALC861_AUTO, |
| 156 | ALC861_MODEL_LAST, |
| 157 | }; |
| 158 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 159 | /* ALC861-VD models */ |
| 160 | enum { |
| 161 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 162 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 163 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 164 | ALC861VD_3ST, |
| 165 | ALC861VD_3ST_DIG, |
| 166 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 167 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 168 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 169 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 170 | ALC861VD_AUTO, |
| 171 | ALC861VD_MODEL_LAST, |
| 172 | }; |
| 173 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 174 | /* ALC662 models */ |
| 175 | enum { |
| 176 | ALC662_3ST_2ch_DIG, |
| 177 | ALC662_3ST_6ch_DIG, |
| 178 | ALC662_3ST_6ch, |
| 179 | ALC662_5ST_DIG, |
| 180 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 181 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 182 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 183 | ALC663_ASUS_M51VA, |
| 184 | ALC663_ASUS_G71V, |
| 185 | ALC663_ASUS_H13, |
| 186 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 187 | ALC662_ECS, |
| 188 | ALC663_ASUS_MODE1, |
| 189 | ALC662_ASUS_MODE2, |
| 190 | ALC663_ASUS_MODE3, |
| 191 | ALC663_ASUS_MODE4, |
| 192 | ALC663_ASUS_MODE5, |
| 193 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 194 | ALC663_ASUS_MODE7, |
| 195 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 196 | ALC272_DELL, |
| 197 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 198 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 199 | ALC662_AUTO, |
| 200 | ALC662_MODEL_LAST, |
| 201 | }; |
| 202 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 203 | /* ALC882 models */ |
| 204 | enum { |
| 205 | ALC882_3ST_DIG, |
| 206 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 207 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 208 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 209 | ALC882_TARGA, |
| 210 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 211 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 212 | ALC885_MACPRO, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 213 | ALC885_MBA21, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 214 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 215 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 216 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 217 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 218 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 219 | ALC883_3ST_2ch_DIG, |
| 220 | ALC883_3ST_6ch_DIG, |
| 221 | ALC883_3ST_6ch, |
| 222 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 223 | ALC883_TARGA_DIG, |
| 224 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 225 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 226 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 227 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 228 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 231 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 232 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 233 | ALC883_MEDION_MD2, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 234 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 235 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 236 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 237 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 238 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 239 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 240 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 241 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 242 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 243 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 244 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 245 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 246 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 247 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 248 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 249 | ALC889A_INTEL, |
| 250 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 251 | ALC888_ASUS_M90V, |
| 252 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 253 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 254 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 255 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 256 | ALC882_AUTO, |
| 257 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 258 | }; |
| 259 | |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 260 | /* ALC680 models */ |
| 261 | enum { |
| 262 | ALC680_BASE, |
| 263 | ALC680_AUTO, |
| 264 | ALC680_MODEL_LAST, |
| 265 | }; |
| 266 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 267 | /* for GPIO Poll */ |
| 268 | #define GPIO_MASK 0x03 |
| 269 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 270 | /* extra amp-initialization sequence types */ |
| 271 | enum { |
| 272 | ALC_INIT_NONE, |
| 273 | ALC_INIT_DEFAULT, |
| 274 | ALC_INIT_GPIO1, |
| 275 | ALC_INIT_GPIO2, |
| 276 | ALC_INIT_GPIO3, |
| 277 | }; |
| 278 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 279 | struct alc_mic_route { |
| 280 | hda_nid_t pin; |
| 281 | unsigned char mux_idx; |
| 282 | unsigned char amix_idx; |
| 283 | }; |
| 284 | |
| 285 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 286 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 287 | struct alc_customize_define { |
| 288 | unsigned int sku_cfg; |
| 289 | unsigned char port_connectivity; |
| 290 | unsigned char check_sum; |
| 291 | unsigned char customization; |
| 292 | unsigned char external_amp; |
| 293 | unsigned int enable_pcbeep:1; |
| 294 | unsigned int platform_type:1; |
| 295 | unsigned int swap:1; |
| 296 | unsigned int override:1; |
| 297 | }; |
| 298 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | struct alc_spec { |
| 300 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 301 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 303 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 304 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 306 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 307 | * don't forget NULL |
| 308 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 309 | */ |
| 310 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 312 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | struct hda_pcm_stream *stream_analog_playback; |
| 314 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 315 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 316 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 318 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | struct hda_pcm_stream *stream_digital_playback; |
| 320 | struct hda_pcm_stream *stream_digital_capture; |
| 321 | |
| 322 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 323 | struct hda_multi_out multiout; /* playback set-up |
| 324 | * max_channels, dacs must be set |
| 325 | * dig_out_nid and hp_nid are optional |
| 326 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 327 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 328 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 329 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | |
| 331 | /* capture */ |
| 332 | unsigned int num_adc_nids; |
| 333 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 334 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 335 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 337 | /* capture setup for dynamic dual-adc switch */ |
| 338 | unsigned int cur_adc_idx; |
| 339 | hda_nid_t cur_adc; |
| 340 | unsigned int cur_adc_stream_tag; |
| 341 | unsigned int cur_adc_format; |
| 342 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 344 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | const struct hda_input_mux *input_mux; |
| 346 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 347 | struct alc_mic_route ext_mic; |
| 348 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 349 | |
| 350 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 351 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 353 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 354 | int const_channel_count; |
| 355 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | |
| 357 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 358 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 359 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 360 | /* dynamic controls, init_verbs and input_mux */ |
| 361 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 362 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 363 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 364 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 365 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 366 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 367 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 368 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 369 | /* hooks */ |
| 370 | void (*init_hook)(struct hda_codec *codec); |
| 371 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 372 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 373 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 374 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 375 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 376 | /* for pin sensing */ |
| 377 | unsigned int sense_updated: 1; |
| 378 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 379 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 380 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 381 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 382 | /* other flags */ |
| 383 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 384 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 385 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 386 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 387 | /* for virtual master */ |
| 388 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 389 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 390 | struct hda_loopback_check loopback; |
| 391 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 392 | |
| 393 | /* for PLL fix */ |
| 394 | hda_nid_t pll_nid; |
| 395 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 396 | }; |
| 397 | |
| 398 | /* |
| 399 | * configuration template - to be copied to the spec instance |
| 400 | */ |
| 401 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 402 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 403 | * with spec |
| 404 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 405 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 406 | const struct hda_verb *init_verbs[5]; |
| 407 | unsigned int num_dacs; |
| 408 | hda_nid_t *dac_nids; |
| 409 | hda_nid_t dig_out_nid; /* optional */ |
| 410 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 411 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 412 | unsigned int num_adc_nids; |
| 413 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 414 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 415 | hda_nid_t dig_in_nid; |
| 416 | unsigned int num_channel_mode; |
| 417 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 418 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 419 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 420 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 421 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 422 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 423 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 424 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 425 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 426 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 427 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 428 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 429 | }; |
| 430 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 431 | |
| 432 | /* |
| 433 | * input MUX handling |
| 434 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 435 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 436 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 437 | { |
| 438 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 439 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 440 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 441 | if (mux_idx >= spec->num_mux_defs) |
| 442 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 443 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 444 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 445 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | } |
| 447 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 448 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 449 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 450 | { |
| 451 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 452 | struct alc_spec *spec = codec->spec; |
| 453 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 454 | |
| 455 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 456 | return 0; |
| 457 | } |
| 458 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 459 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 460 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | { |
| 462 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 463 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 464 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 466 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 467 | hda_nid_t nid = spec->capsrc_nids ? |
| 468 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 469 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 470 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 471 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 472 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 473 | if (!imux->num_items && mux_idx > 0) |
| 474 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 475 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 476 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 477 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 478 | /* Matrix-mixer style (e.g. ALC882) */ |
| 479 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 480 | unsigned int i, idx; |
| 481 | |
| 482 | idx = ucontrol->value.enumerated.item[0]; |
| 483 | if (idx >= imux->num_items) |
| 484 | idx = imux->num_items - 1; |
| 485 | if (*cur_val == idx) |
| 486 | return 0; |
| 487 | for (i = 0; i < imux->num_items; i++) { |
| 488 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 489 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 490 | imux->items[i].index, |
| 491 | HDA_AMP_MUTE, v); |
| 492 | } |
| 493 | *cur_val = idx; |
| 494 | return 1; |
| 495 | } else { |
| 496 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 497 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 498 | &spec->cur_mux[adc_idx]); |
| 499 | } |
| 500 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 501 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 502 | /* |
| 503 | * channel mode setting |
| 504 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 505 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 506 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 507 | { |
| 508 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 509 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 510 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 511 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 512 | } |
| 513 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 514 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 515 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 516 | { |
| 517 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 518 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 519 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 520 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 521 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 522 | } |
| 523 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 524 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 525 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 526 | { |
| 527 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 528 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 529 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 530 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 531 | &spec->ext_channel_count); |
| 532 | if (err >= 0 && !spec->const_channel_count) { |
| 533 | spec->multiout.max_channels = spec->ext_channel_count; |
| 534 | if (spec->need_dac_fix) |
| 535 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 536 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 537 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | } |
| 539 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 541 | * Control the mode of pin widget settings via the mixer. "pc" is used |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 542 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 543 | * being part of a format specifier. Maximum allowed length of a value is |
| 544 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 545 | * |
| 546 | * Note: some retasking pin complexes seem to ignore requests for input |
| 547 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 548 | * are requested. Therefore order this list so that this behaviour will not |
| 549 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 550 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 551 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 552 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 553 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 554 | "Mic 50pc bias", "Mic 80pc bias", |
| 555 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 556 | }; |
| 557 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 558 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 559 | }; |
| 560 | /* The control can present all 5 options, or it can limit the options based |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 561 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 562 | * addition, "input" pins may or may not process the mic bias option |
| 563 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 564 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 565 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 566 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 567 | #define ALC_PIN_DIR_IN 0x00 |
| 568 | #define ALC_PIN_DIR_OUT 0x01 |
| 569 | #define ALC_PIN_DIR_INOUT 0x02 |
| 570 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 571 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 572 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 573 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 574 | * For each direction the minimum and maximum values are given. |
| 575 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 576 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 577 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 578 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 579 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 580 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 581 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 582 | }; |
| 583 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 584 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 585 | #define alc_pin_mode_n_items(_dir) \ |
| 586 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 587 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 588 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 589 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 590 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 591 | unsigned int item_num = uinfo->value.enumerated.item; |
| 592 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 593 | |
| 594 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 595 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 596 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 597 | |
| 598 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 599 | item_num = alc_pin_mode_min(dir); |
| 600 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 601 | return 0; |
| 602 | } |
| 603 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 604 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 605 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 606 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 607 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 608 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 609 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 610 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 611 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 612 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 613 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 614 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 615 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 616 | /* Find enumerated value for current pinctl setting */ |
| 617 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 618 | while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 619 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 620 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 621 | return 0; |
| 622 | } |
| 623 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 624 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 625 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 626 | { |
| 627 | signed int change; |
| 628 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 629 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 630 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 631 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 632 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 633 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 634 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 635 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 636 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 637 | val = alc_pin_mode_min(dir); |
| 638 | |
| 639 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 640 | if (change) { |
| 641 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 642 | snd_hda_codec_write_cache(codec, nid, 0, |
| 643 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 644 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 645 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 646 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 647 | * for the requested pin mode. Enum values of 2 or less are |
| 648 | * input modes. |
| 649 | * |
| 650 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 651 | * reduces noise slightly (particularly on input) so we'll |
| 652 | * do it. However, having both input and output buffers |
| 653 | * enabled simultaneously doesn't seem to be problematic if |
| 654 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 655 | */ |
| 656 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 657 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 658 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 659 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 660 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 661 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 662 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 663 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 664 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 665 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 666 | } |
| 667 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 668 | return change; |
| 669 | } |
| 670 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 671 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 672 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 673 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 674 | .info = alc_pin_mode_info, \ |
| 675 | .get = alc_pin_mode_get, \ |
| 676 | .put = alc_pin_mode_put, \ |
| 677 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 678 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 679 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 680 | * together using a mask with more than one bit set. This control is |
| 681 | * currently used only by the ALC260 test model. At this stage they are not |
| 682 | * needed for any "production" models. |
| 683 | */ |
| 684 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 685 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 686 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 687 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 688 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 689 | { |
| 690 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 691 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 692 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 693 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 694 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 695 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 696 | |
| 697 | *valp = (val & mask) != 0; |
| 698 | return 0; |
| 699 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 700 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 701 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 702 | { |
| 703 | signed int change; |
| 704 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 705 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 706 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 707 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 708 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 709 | AC_VERB_GET_GPIO_DATA, |
| 710 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 711 | |
| 712 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 713 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 714 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 715 | gpio_data &= ~mask; |
| 716 | else |
| 717 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 718 | snd_hda_codec_write_cache(codec, nid, 0, |
| 719 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 720 | |
| 721 | return change; |
| 722 | } |
| 723 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 724 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 725 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 726 | .info = alc_gpio_data_info, \ |
| 727 | .get = alc_gpio_data_get, \ |
| 728 | .put = alc_gpio_data_put, \ |
| 729 | .private_value = nid | (mask<<16) } |
| 730 | #endif /* CONFIG_SND_DEBUG */ |
| 731 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 732 | /* A switch control to allow the enabling of the digital IO pins on the |
| 733 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 734 | * to provide something in the test model allowing digital outputs to be |
| 735 | * identified if present. If models are found which can utilise these |
| 736 | * outputs a more complete mixer control can be devised for those models if |
| 737 | * necessary. |
| 738 | */ |
| 739 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 740 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 741 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 742 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 743 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 744 | { |
| 745 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 746 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 747 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 748 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 749 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 750 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 751 | |
| 752 | *valp = (val & mask) != 0; |
| 753 | return 0; |
| 754 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 755 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 756 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 757 | { |
| 758 | signed int change; |
| 759 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 760 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 761 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 762 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 763 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 764 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 765 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 766 | |
| 767 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 768 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 769 | if (val==0) |
| 770 | ctrl_data &= ~mask; |
| 771 | else |
| 772 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 773 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 774 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 775 | |
| 776 | return change; |
| 777 | } |
| 778 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 779 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 780 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 781 | .info = alc_spdif_ctrl_info, \ |
| 782 | .get = alc_spdif_ctrl_get, \ |
| 783 | .put = alc_spdif_ctrl_put, \ |
| 784 | .private_value = nid | (mask<<16) } |
| 785 | #endif /* CONFIG_SND_DEBUG */ |
| 786 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 787 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 788 | * Again, this is only used in the ALC26x test models to help identify when |
| 789 | * the EAPD line must be asserted for features to work. |
| 790 | */ |
| 791 | #ifdef CONFIG_SND_DEBUG |
| 792 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 793 | |
| 794 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 795 | struct snd_ctl_elem_value *ucontrol) |
| 796 | { |
| 797 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 798 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 799 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 800 | long *valp = ucontrol->value.integer.value; |
| 801 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 802 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 803 | |
| 804 | *valp = (val & mask) != 0; |
| 805 | return 0; |
| 806 | } |
| 807 | |
| 808 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 809 | struct snd_ctl_elem_value *ucontrol) |
| 810 | { |
| 811 | int change; |
| 812 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 813 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 814 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 815 | long val = *ucontrol->value.integer.value; |
| 816 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 817 | AC_VERB_GET_EAPD_BTLENABLE, |
| 818 | 0x00); |
| 819 | |
| 820 | /* Set/unset the masked control bit(s) as needed */ |
| 821 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 822 | if (!val) |
| 823 | ctrl_data &= ~mask; |
| 824 | else |
| 825 | ctrl_data |= mask; |
| 826 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 827 | ctrl_data); |
| 828 | |
| 829 | return change; |
| 830 | } |
| 831 | |
| 832 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 833 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 834 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 835 | .info = alc_eapd_ctrl_info, \ |
| 836 | .get = alc_eapd_ctrl_get, \ |
| 837 | .put = alc_eapd_ctrl_put, \ |
| 838 | .private_value = nid | (mask<<16) } |
| 839 | #endif /* CONFIG_SND_DEBUG */ |
| 840 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 841 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 842 | * set up the input pin config (depending on the given auto-pin type) |
| 843 | */ |
| 844 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 845 | int auto_pin_type) |
| 846 | { |
| 847 | unsigned int val = PIN_IN; |
| 848 | |
| 849 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 850 | unsigned int pincap; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 851 | unsigned int oldval; |
| 852 | oldval = snd_hda_codec_read(codec, nid, 0, |
| 853 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 854 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 855 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 856 | /* if the default pin setup is vref50, we give it priority */ |
| 857 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 858 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 859 | else if (pincap & AC_PINCAP_VREF_50) |
| 860 | val = PIN_VREF50; |
| 861 | else if (pincap & AC_PINCAP_VREF_100) |
| 862 | val = PIN_VREF100; |
| 863 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 864 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 865 | } |
| 866 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 867 | } |
| 868 | |
| 869 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 870 | */ |
| 871 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 872 | { |
| 873 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 874 | return; |
| 875 | spec->mixers[spec->num_mixers++] = mix; |
| 876 | } |
| 877 | |
| 878 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 879 | { |
| 880 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 881 | return; |
| 882 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 883 | } |
| 884 | |
| 885 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 886 | * set up from the preset table |
| 887 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 888 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 889 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 890 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 891 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 892 | int i; |
| 893 | |
| 894 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 895 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 896 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 897 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 898 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 899 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 900 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 901 | spec->channel_mode = preset->channel_mode; |
| 902 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 903 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 904 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 905 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 906 | if (preset->const_channel_count) |
| 907 | spec->multiout.max_channels = preset->const_channel_count; |
| 908 | else |
| 909 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 910 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 911 | |
| 912 | spec->multiout.num_dacs = preset->num_dacs; |
| 913 | spec->multiout.dac_nids = preset->dac_nids; |
| 914 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 915 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 916 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 917 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 918 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 919 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 920 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 921 | spec->input_mux = preset->input_mux; |
| 922 | |
| 923 | spec->num_adc_nids = preset->num_adc_nids; |
| 924 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 925 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 926 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 927 | |
| 928 | spec->unsol_event = preset->unsol_event; |
| 929 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 930 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 931 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 932 | spec->loopback.amplist = preset->loopbacks; |
| 933 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 934 | |
| 935 | if (preset->setup) |
| 936 | preset->setup(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 937 | } |
| 938 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 939 | /* Enable GPIO mask and set output */ |
| 940 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 941 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 942 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 943 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 944 | { } |
| 945 | }; |
| 946 | |
| 947 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 948 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 949 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 950 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 951 | { } |
| 952 | }; |
| 953 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 954 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 955 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 956 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 957 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 958 | { } |
| 959 | }; |
| 960 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 961 | /* |
| 962 | * Fix hardware PLL issue |
| 963 | * On some codecs, the analog PLL gating control must be off while |
| 964 | * the default value is 1. |
| 965 | */ |
| 966 | static void alc_fix_pll(struct hda_codec *codec) |
| 967 | { |
| 968 | struct alc_spec *spec = codec->spec; |
| 969 | unsigned int val; |
| 970 | |
| 971 | if (!spec->pll_nid) |
| 972 | return; |
| 973 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 974 | spec->pll_coef_idx); |
| 975 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 976 | AC_VERB_GET_PROC_COEF, 0); |
| 977 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 978 | spec->pll_coef_idx); |
| 979 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 980 | val & ~(1 << spec->pll_coef_bit)); |
| 981 | } |
| 982 | |
| 983 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 984 | unsigned int coef_idx, unsigned int coef_bit) |
| 985 | { |
| 986 | struct alc_spec *spec = codec->spec; |
| 987 | spec->pll_nid = nid; |
| 988 | spec->pll_coef_idx = coef_idx; |
| 989 | spec->pll_coef_bit = coef_bit; |
| 990 | alc_fix_pll(codec); |
| 991 | } |
| 992 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 993 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 994 | { |
| 995 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 996 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 997 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 998 | |
Takashi Iwai | ad87c64 | 2009-11-02 14:23:15 +0100 | [diff] [blame] | 999 | if (!nid) |
| 1000 | return; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1001 | spec->jack_present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1002 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1003 | nid = spec->autocfg.speaker_pins[i]; |
| 1004 | if (!nid) |
| 1005 | break; |
| 1006 | snd_hda_codec_write(codec, nid, 0, |
| 1007 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1008 | spec->jack_present ? 0 : PIN_OUT); |
| 1009 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1010 | } |
| 1011 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1012 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 1013 | hda_nid_t nid) |
| 1014 | { |
| 1015 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 1016 | int i, nums; |
| 1017 | |
| 1018 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1019 | for (i = 0; i < nums; i++) |
| 1020 | if (conn[i] == nid) |
| 1021 | return i; |
| 1022 | return -1; |
| 1023 | } |
| 1024 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1025 | /* switch the current ADC according to the jack state */ |
| 1026 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1027 | { |
| 1028 | struct alc_spec *spec = codec->spec; |
| 1029 | unsigned int present; |
| 1030 | hda_nid_t new_adc; |
| 1031 | |
| 1032 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1033 | if (present) |
| 1034 | spec->cur_adc_idx = 1; |
| 1035 | else |
| 1036 | spec->cur_adc_idx = 0; |
| 1037 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1038 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1039 | /* stream is running, let's swap the current ADC */ |
Takashi Iwai | f0cea79 | 2010-08-13 11:56:53 +0200 | [diff] [blame^] | 1040 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1041 | spec->cur_adc = new_adc; |
| 1042 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1043 | spec->cur_adc_stream_tag, 0, |
| 1044 | spec->cur_adc_format); |
| 1045 | } |
| 1046 | } |
| 1047 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1048 | static void alc_mic_automute(struct hda_codec *codec) |
| 1049 | { |
| 1050 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1051 | struct alc_mic_route *dead, *alive; |
| 1052 | unsigned int present, type; |
| 1053 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1054 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1055 | if (!spec->auto_mic) |
| 1056 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1057 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1058 | return; |
| 1059 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1060 | return; |
| 1061 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1062 | if (spec->dual_adc_switch) { |
| 1063 | alc_dual_mic_adc_auto_switch(codec); |
| 1064 | return; |
| 1065 | } |
| 1066 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1067 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1068 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1069 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1070 | if (present) { |
| 1071 | alive = &spec->ext_mic; |
| 1072 | dead = &spec->int_mic; |
| 1073 | } else { |
| 1074 | alive = &spec->int_mic; |
| 1075 | dead = &spec->ext_mic; |
| 1076 | } |
| 1077 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1078 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1079 | if (type == AC_WID_AUD_MIX) { |
| 1080 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1081 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1082 | alive->mux_idx, |
| 1083 | HDA_AMP_MUTE, 0); |
| 1084 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1085 | dead->mux_idx, |
| 1086 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1087 | } else { |
| 1088 | /* MUX style (e.g. ALC880) */ |
| 1089 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1090 | AC_VERB_SET_CONNECT_SEL, |
| 1091 | alive->mux_idx); |
| 1092 | } |
| 1093 | |
| 1094 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1095 | } |
| 1096 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1097 | /* unsolicited event for HP jack sensing */ |
| 1098 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1099 | { |
| 1100 | if (codec->vendor_id == 0x10ec0880) |
| 1101 | res >>= 28; |
| 1102 | else |
| 1103 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1104 | switch (res) { |
| 1105 | case ALC880_HP_EVENT: |
| 1106 | alc_automute_pin(codec); |
| 1107 | break; |
| 1108 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1109 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1110 | break; |
| 1111 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1112 | } |
| 1113 | |
| 1114 | static void alc_inithook(struct hda_codec *codec) |
| 1115 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1116 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1117 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1118 | } |
| 1119 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1120 | /* additional initialization for ALC888 variants */ |
| 1121 | static void alc888_coef_init(struct hda_codec *codec) |
| 1122 | { |
| 1123 | unsigned int tmp; |
| 1124 | |
| 1125 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1126 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1127 | 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] | 1128 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1129 | /* alc888S-VC */ |
| 1130 | snd_hda_codec_read(codec, 0x20, 0, |
| 1131 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1132 | else |
| 1133 | /* alc888-VB */ |
| 1134 | snd_hda_codec_read(codec, 0x20, 0, |
| 1135 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1136 | } |
| 1137 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1138 | static void alc889_coef_init(struct hda_codec *codec) |
| 1139 | { |
| 1140 | unsigned int tmp; |
| 1141 | |
| 1142 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1143 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1144 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1145 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1146 | } |
| 1147 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1148 | /* turn on/off EAPD control (only if available) */ |
| 1149 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1150 | { |
| 1151 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1152 | return; |
| 1153 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1154 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1155 | on ? 2 : 0); |
| 1156 | } |
| 1157 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1158 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1159 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1160 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1161 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1162 | switch (type) { |
| 1163 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1164 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1165 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1166 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1167 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1168 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1169 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1170 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1171 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1172 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1173 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1174 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1175 | set_eapd(codec, 0x0f, 1); |
| 1176 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1177 | break; |
| 1178 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1179 | case 0x10ec0267: |
| 1180 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1181 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1182 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1183 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1184 | case 0x10ec0660: |
| 1185 | case 0x10ec0662: |
| 1186 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1187 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1188 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1189 | set_eapd(codec, 0x14, 1); |
| 1190 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1191 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1192 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1193 | switch (codec->vendor_id) { |
| 1194 | case 0x10ec0260: |
| 1195 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1196 | AC_VERB_SET_COEF_INDEX, 7); |
| 1197 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1198 | AC_VERB_GET_PROC_COEF, 0); |
| 1199 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1200 | AC_VERB_SET_COEF_INDEX, 7); |
| 1201 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1202 | AC_VERB_SET_PROC_COEF, |
| 1203 | tmp | 0x2010); |
| 1204 | break; |
| 1205 | case 0x10ec0262: |
| 1206 | case 0x10ec0880: |
| 1207 | case 0x10ec0882: |
| 1208 | case 0x10ec0883: |
| 1209 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1210 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1211 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1212 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1213 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1214 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1215 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1216 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1217 | #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] | 1218 | case 0x10ec0267: |
| 1219 | case 0x10ec0268: |
| 1220 | snd_hda_codec_write(codec, 0x20, 0, |
| 1221 | AC_VERB_SET_COEF_INDEX, 7); |
| 1222 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1223 | AC_VERB_GET_PROC_COEF, 0); |
| 1224 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1225 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1226 | snd_hda_codec_write(codec, 0x20, 0, |
| 1227 | AC_VERB_SET_PROC_COEF, |
| 1228 | tmp | 0x3000); |
| 1229 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1230 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1231 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1232 | break; |
| 1233 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1234 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1235 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1236 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1237 | { |
| 1238 | struct alc_spec *spec = codec->spec; |
| 1239 | |
| 1240 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1241 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1242 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1243 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1244 | if (spec->autocfg.line_out_pins[0] && |
| 1245 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1246 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1247 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1248 | else |
| 1249 | return; |
| 1250 | } |
| 1251 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1252 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1253 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1254 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1255 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1256 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1257 | spec->unsol_event = alc_sku_unsol_event; |
| 1258 | } |
| 1259 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1260 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1261 | { |
| 1262 | struct alc_spec *spec = codec->spec; |
| 1263 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1264 | hda_nid_t fixed, ext; |
| 1265 | int i; |
| 1266 | |
| 1267 | /* there must be only two mic inputs exclusively */ |
| 1268 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) |
| 1269 | if (cfg->input_pins[i]) |
| 1270 | return; |
| 1271 | |
| 1272 | fixed = ext = 0; |
| 1273 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { |
| 1274 | hda_nid_t nid = cfg->input_pins[i]; |
| 1275 | unsigned int defcfg; |
| 1276 | if (!nid) |
| 1277 | return; |
| 1278 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1279 | switch (get_defcfg_connect(defcfg)) { |
| 1280 | case AC_JACK_PORT_FIXED: |
| 1281 | if (fixed) |
| 1282 | return; /* already occupied */ |
| 1283 | fixed = nid; |
| 1284 | break; |
| 1285 | case AC_JACK_PORT_COMPLEX: |
| 1286 | if (ext) |
| 1287 | return; /* already occupied */ |
| 1288 | ext = nid; |
| 1289 | break; |
| 1290 | default: |
| 1291 | return; /* invalid entry */ |
| 1292 | } |
| 1293 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1294 | if (!ext || !fixed) |
| 1295 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1296 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1297 | return; /* no unsol support */ |
| 1298 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1299 | ext, fixed); |
| 1300 | spec->ext_mic.pin = ext; |
| 1301 | spec->int_mic.pin = fixed; |
| 1302 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1303 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1304 | spec->auto_mic = 1; |
| 1305 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1306 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1307 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1308 | spec->unsol_event = alc_sku_unsol_event; |
| 1309 | } |
| 1310 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1311 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1312 | { |
| 1313 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1314 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1315 | struct alc_spec *spec = codec->spec; |
| 1316 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1317 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1318 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1319 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1320 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1321 | goto do_sku; |
| 1322 | |
| 1323 | nid = 0x1d; |
| 1324 | if (codec->vendor_id == 0x10ec0260) |
| 1325 | nid = 0x17; |
| 1326 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1327 | |
| 1328 | if (!(ass & 1)) { |
| 1329 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1330 | codec->chip_name, ass); |
| 1331 | return -1; |
| 1332 | } |
| 1333 | |
| 1334 | /* check sum */ |
| 1335 | tmp = 0; |
| 1336 | for (i = 1; i < 16; i++) { |
| 1337 | if ((ass >> i) & 1) |
| 1338 | tmp++; |
| 1339 | } |
| 1340 | if (((ass >> 16) & 0xf) != tmp) |
| 1341 | return -1; |
| 1342 | |
| 1343 | spec->cdefine.port_connectivity = ass >> 30; |
| 1344 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1345 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1346 | spec->cdefine.customization = ass >> 8; |
| 1347 | do_sku: |
| 1348 | spec->cdefine.sku_cfg = ass; |
| 1349 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1350 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1351 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1352 | spec->cdefine.override = ass & 0x1; |
| 1353 | |
| 1354 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1355 | nid, spec->cdefine.sku_cfg); |
| 1356 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1357 | spec->cdefine.port_connectivity); |
| 1358 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1359 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1360 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1361 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1362 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1363 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1364 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1365 | |
| 1366 | return 0; |
| 1367 | } |
| 1368 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1369 | /* check subsystem ID and set up device-specific initialization; |
| 1370 | * return 1 if initialized, 0 if invalid SSID |
| 1371 | */ |
| 1372 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1373 | * 31 ~ 16 : Manufacture ID |
| 1374 | * 15 ~ 8 : SKU ID |
| 1375 | * 7 ~ 0 : Assembly ID |
| 1376 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1377 | */ |
| 1378 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1379 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1380 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1381 | { |
| 1382 | unsigned int ass, tmp, i; |
| 1383 | unsigned nid; |
| 1384 | struct alc_spec *spec = codec->spec; |
| 1385 | |
| 1386 | ass = codec->subsystem_id & 0xffff; |
| 1387 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1388 | goto do_sku; |
| 1389 | |
| 1390 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1391 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1392 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1393 | * 29~21 : reserve |
| 1394 | * 20 : PCBEEP input |
| 1395 | * 19~16 : Check sum (15:1) |
| 1396 | * 15~1 : Custom |
| 1397 | * 0 : override |
| 1398 | */ |
| 1399 | nid = 0x1d; |
| 1400 | if (codec->vendor_id == 0x10ec0260) |
| 1401 | nid = 0x17; |
| 1402 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1403 | snd_printd("realtek: No valid SSID, " |
| 1404 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1405 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1406 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1407 | return 0; |
| 1408 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1409 | return 0; |
| 1410 | |
| 1411 | /* check sum */ |
| 1412 | tmp = 0; |
| 1413 | for (i = 1; i < 16; i++) { |
| 1414 | if ((ass >> i) & 1) |
| 1415 | tmp++; |
| 1416 | } |
| 1417 | if (((ass >> 16) & 0xf) != tmp) |
| 1418 | return 0; |
| 1419 | do_sku: |
| 1420 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1421 | ass & 0xffff, codec->vendor_id); |
| 1422 | /* |
| 1423 | * 0 : override |
| 1424 | * 1 : Swap Jack |
| 1425 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1426 | * 3~5 : External Amplifier control |
| 1427 | * 7~6 : Reserved |
| 1428 | */ |
| 1429 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1430 | switch (tmp) { |
| 1431 | case 1: |
| 1432 | spec->init_amp = ALC_INIT_GPIO1; |
| 1433 | break; |
| 1434 | case 3: |
| 1435 | spec->init_amp = ALC_INIT_GPIO2; |
| 1436 | break; |
| 1437 | case 7: |
| 1438 | spec->init_amp = ALC_INIT_GPIO3; |
| 1439 | break; |
| 1440 | case 5: |
| 1441 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1442 | break; |
| 1443 | } |
| 1444 | |
| 1445 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1446 | * when the external headphone out jack is plugged" |
| 1447 | */ |
| 1448 | if (!(ass & 0x8000)) |
| 1449 | return 1; |
| 1450 | /* |
| 1451 | * 10~8 : Jack location |
| 1452 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1453 | * 14~13: Resvered |
| 1454 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1455 | * when the external headphone out jack is plugged" |
| 1456 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1457 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1458 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1459 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1460 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1461 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1462 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1463 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1464 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1465 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1466 | else if (tmp == 3) |
| 1467 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1468 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1469 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1470 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1471 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1472 | return 1; |
| 1473 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1474 | } |
| 1475 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1476 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1477 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1478 | return 1; |
| 1479 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1480 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1481 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1482 | hda_nid_t porta, hda_nid_t porte, |
| 1483 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1484 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1485 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1486 | struct alc_spec *spec = codec->spec; |
| 1487 | snd_printd("realtek: " |
| 1488 | "Enable default setup for auto mode as fallback\n"); |
| 1489 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1490 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1491 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1492 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1493 | } |
| 1494 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1495 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1496 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1497 | */ |
| 1498 | |
| 1499 | struct alc_pincfg { |
| 1500 | hda_nid_t nid; |
| 1501 | u32 val; |
| 1502 | }; |
| 1503 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1504 | struct alc_fixup { |
| 1505 | const struct alc_pincfg *pins; |
| 1506 | const struct hda_verb *verbs; |
| 1507 | }; |
| 1508 | |
| 1509 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1510 | const struct snd_pci_quirk *quirk, |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1511 | const struct alc_fixup *fix, |
| 1512 | int pre_init) |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1513 | { |
| 1514 | const struct alc_pincfg *cfg; |
| 1515 | |
| 1516 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1517 | if (!quirk) |
| 1518 | return; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1519 | fix += quirk->value; |
| 1520 | cfg = fix->pins; |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1521 | if (pre_init && cfg) { |
| 1522 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1523 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", |
| 1524 | codec->chip_name, quirk->name); |
| 1525 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1526 | for (; cfg->nid; cfg++) |
| 1527 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
| 1528 | } |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1529 | if (!pre_init && fix->verbs) { |
| 1530 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1531 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", |
| 1532 | codec->chip_name, quirk->name); |
| 1533 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1534 | add_verb(codec->spec, fix->verbs); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1535 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1536 | } |
| 1537 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1538 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1539 | unsigned int coef_idx) |
| 1540 | { |
| 1541 | unsigned int val; |
| 1542 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1543 | coef_idx); |
| 1544 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1545 | AC_VERB_GET_PROC_COEF, 0); |
| 1546 | return val; |
| 1547 | } |
| 1548 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 1549 | /* set right pin controls for digital I/O */ |
| 1550 | static void alc_auto_init_digital(struct hda_codec *codec) |
| 1551 | { |
| 1552 | struct alc_spec *spec = codec->spec; |
| 1553 | int i; |
| 1554 | hda_nid_t pin; |
| 1555 | |
| 1556 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1557 | pin = spec->autocfg.dig_out_pins[i]; |
| 1558 | if (pin) { |
| 1559 | snd_hda_codec_write(codec, pin, 0, |
| 1560 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1561 | PIN_OUT); |
| 1562 | } |
| 1563 | } |
| 1564 | pin = spec->autocfg.dig_in_pin; |
| 1565 | if (pin) |
| 1566 | snd_hda_codec_write(codec, pin, 0, |
| 1567 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1568 | PIN_IN); |
| 1569 | } |
| 1570 | |
| 1571 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ |
| 1572 | static void alc_auto_parse_digital(struct hda_codec *codec) |
| 1573 | { |
| 1574 | struct alc_spec *spec = codec->spec; |
| 1575 | int i, err; |
| 1576 | hda_nid_t dig_nid; |
| 1577 | |
| 1578 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
| 1579 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 1580 | err = snd_hda_get_connections(codec, |
| 1581 | spec->autocfg.dig_out_pins[i], |
| 1582 | &dig_nid, 1); |
| 1583 | if (err < 0) |
| 1584 | continue; |
| 1585 | if (!i) { |
| 1586 | spec->multiout.dig_out_nid = dig_nid; |
| 1587 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 1588 | } else { |
| 1589 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 1590 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 1591 | break; |
| 1592 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 1593 | } |
| 1594 | } |
| 1595 | |
| 1596 | if (spec->autocfg.dig_in_pin) { |
| 1597 | hda_nid_t dig_nid; |
| 1598 | err = snd_hda_get_connections(codec, |
| 1599 | spec->autocfg.dig_in_pin, |
| 1600 | &dig_nid, 1); |
| 1601 | if (err > 0) |
| 1602 | spec->dig_in_nid = dig_nid; |
| 1603 | } |
| 1604 | } |
| 1605 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1606 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1607 | * ALC888 |
| 1608 | */ |
| 1609 | |
| 1610 | /* |
| 1611 | * 2ch mode |
| 1612 | */ |
| 1613 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1614 | /* Mic-in jack as mic in */ |
| 1615 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1616 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1617 | /* Line-in jack as Line in */ |
| 1618 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1619 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1620 | /* Line-Out as Front */ |
| 1621 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1622 | { } /* end */ |
| 1623 | }; |
| 1624 | |
| 1625 | /* |
| 1626 | * 4ch mode |
| 1627 | */ |
| 1628 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1629 | /* Mic-in jack as mic in */ |
| 1630 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1631 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1632 | /* Line-in jack as Surround */ |
| 1633 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1634 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1635 | /* Line-Out as Front */ |
| 1636 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1637 | { } /* end */ |
| 1638 | }; |
| 1639 | |
| 1640 | /* |
| 1641 | * 6ch mode |
| 1642 | */ |
| 1643 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1644 | /* Mic-in jack as CLFE */ |
| 1645 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1646 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1647 | /* Line-in jack as Surround */ |
| 1648 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1649 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1650 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1651 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1652 | { } /* end */ |
| 1653 | }; |
| 1654 | |
| 1655 | /* |
| 1656 | * 8ch mode |
| 1657 | */ |
| 1658 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1659 | /* Mic-in jack as CLFE */ |
| 1660 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1661 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1662 | /* Line-in jack as Surround */ |
| 1663 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1664 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1665 | /* Line-Out as Side */ |
| 1666 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1667 | { } /* end */ |
| 1668 | }; |
| 1669 | |
| 1670 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1671 | { 2, alc888_4ST_ch2_intel_init }, |
| 1672 | { 4, alc888_4ST_ch4_intel_init }, |
| 1673 | { 6, alc888_4ST_ch6_intel_init }, |
| 1674 | { 8, alc888_4ST_ch8_intel_init }, |
| 1675 | }; |
| 1676 | |
| 1677 | /* |
| 1678 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1679 | */ |
| 1680 | |
| 1681 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1682 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1683 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1684 | /* Connect Internal HP to Front */ |
| 1685 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1686 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1687 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1688 | /* Connect Bass HP to Front */ |
| 1689 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1690 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1691 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1692 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1693 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1694 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1695 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1696 | /* Connect Mic jack to CLFE */ |
| 1697 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1698 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1699 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1700 | /* Connect Line-in jack to Surround */ |
| 1701 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1702 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1703 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1704 | /* Connect HP out jack to Front */ |
| 1705 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1706 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1707 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1708 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1709 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1710 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1711 | {} |
| 1712 | }; |
| 1713 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1714 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1715 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1716 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1717 | unsigned int mute; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1718 | hda_nid_t nid; |
| 1719 | int i; |
| 1720 | |
| 1721 | spec->jack_present = 0; |
| 1722 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1723 | nid = spec->autocfg.hp_pins[i]; |
| 1724 | if (!nid) |
| 1725 | break; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1726 | if (snd_hda_jack_detect(codec, nid)) { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1727 | spec->jack_present = 1; |
| 1728 | break; |
| 1729 | } |
| 1730 | } |
| 1731 | |
| 1732 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1733 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1734 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1735 | nid = spec->autocfg.speaker_pins[i]; |
| 1736 | if (!nid) |
| 1737 | break; |
| 1738 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1739 | HDA_AMP_MUTE, mute); |
| 1740 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1741 | } |
| 1742 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1743 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1744 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1745 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1746 | if (codec->vendor_id == 0x10ec0880) |
| 1747 | res >>= 28; |
| 1748 | else |
| 1749 | res >>= 26; |
| 1750 | if (res == ALC880_HP_EVENT) |
| 1751 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1752 | } |
| 1753 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1754 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1755 | { |
| 1756 | struct alc_spec *spec = codec->spec; |
| 1757 | |
| 1758 | spec->autocfg.hp_pins[0] = 0x15; |
| 1759 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1760 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1761 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1762 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1763 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1764 | } |
| 1765 | |
| 1766 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1767 | { |
| 1768 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1769 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1770 | } |
| 1771 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1772 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1773 | { |
| 1774 | struct alc_spec *spec = codec->spec; |
| 1775 | |
| 1776 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1777 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1778 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1779 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1780 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1781 | |
| 1782 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1783 | * ALC888 Acer Aspire 4930G model |
| 1784 | */ |
| 1785 | |
| 1786 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1787 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1788 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1789 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1790 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1791 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1792 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1793 | /* Connect Internal HP to front */ |
| 1794 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1795 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1796 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1797 | /* Connect HP out to front */ |
| 1798 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1799 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1800 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1801 | { } |
| 1802 | }; |
| 1803 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1804 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1805 | * ALC888 Acer Aspire 6530G model |
| 1806 | */ |
| 1807 | |
| 1808 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1809 | /* Route to built-in subwoofer as well as speakers */ |
| 1810 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1811 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1812 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1813 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1814 | /* Bias voltage on for external mic port */ |
| 1815 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1816 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1817 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1818 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1819 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1820 | /* Enable unsolicited event for HP jack */ |
| 1821 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1822 | /* Enable speaker output */ |
| 1823 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1824 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1825 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1826 | /* Enable headphone output */ |
| 1827 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1828 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1829 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1830 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1831 | { } |
| 1832 | }; |
| 1833 | |
| 1834 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1835 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1836 | */ |
| 1837 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1838 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1839 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1840 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1841 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1842 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1843 | /* Enable unsolicited event for HP jack */ |
| 1844 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1845 | /* Connect Internal Front to Front */ |
| 1846 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1847 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1848 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1849 | /* Connect Internal Rear to Rear */ |
| 1850 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1851 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1852 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1853 | /* Connect Internal CLFE to CLFE */ |
| 1854 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1855 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1856 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1857 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1858 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1859 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1860 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1861 | /* Enable all DACs */ |
| 1862 | /* DAC DISABLE/MUTE 1? */ |
| 1863 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1864 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1865 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1866 | /* DAC DISABLE/MUTE 2? */ |
| 1867 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1868 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1869 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1870 | /* DMIC fix |
| 1871 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1872 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1873 | * makes the signal become a difference/sum signal instead of standard |
| 1874 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1875 | * codec replicate the sum signal to both channels, turning it into a |
| 1876 | * normal mono mic. |
| 1877 | */ |
| 1878 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1879 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1880 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1881 | { } |
| 1882 | }; |
| 1883 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1884 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1885 | /* Front mic only available on one ADC */ |
| 1886 | { |
| 1887 | .num_items = 4, |
| 1888 | .items = { |
| 1889 | { "Mic", 0x0 }, |
| 1890 | { "Line", 0x2 }, |
| 1891 | { "CD", 0x4 }, |
| 1892 | { "Front Mic", 0xb }, |
| 1893 | }, |
| 1894 | }, |
| 1895 | { |
| 1896 | .num_items = 3, |
| 1897 | .items = { |
| 1898 | { "Mic", 0x0 }, |
| 1899 | { "Line", 0x2 }, |
| 1900 | { "CD", 0x4 }, |
| 1901 | }, |
| 1902 | } |
| 1903 | }; |
| 1904 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1905 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1906 | /* Interal mic only available on one ADC */ |
| 1907 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1908 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1909 | .items = { |
| 1910 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1911 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1912 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1913 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1914 | { "Int Mic", 0xb }, |
| 1915 | }, |
| 1916 | }, |
| 1917 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1918 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1919 | .items = { |
| 1920 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1921 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1922 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1923 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1924 | }, |
| 1925 | } |
| 1926 | }; |
| 1927 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1928 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1929 | /* Digital mic only available on first "ADC" */ |
| 1930 | { |
| 1931 | .num_items = 5, |
| 1932 | .items = { |
| 1933 | { "Mic", 0x0 }, |
| 1934 | { "Line", 0x2 }, |
| 1935 | { "CD", 0x4 }, |
| 1936 | { "Front Mic", 0xb }, |
| 1937 | { "Input Mix", 0xa }, |
| 1938 | }, |
| 1939 | }, |
| 1940 | { |
| 1941 | .num_items = 4, |
| 1942 | .items = { |
| 1943 | { "Mic", 0x0 }, |
| 1944 | { "Line", 0x2 }, |
| 1945 | { "CD", 0x4 }, |
| 1946 | { "Input Mix", 0xa }, |
| 1947 | }, |
| 1948 | }, |
| 1949 | { |
| 1950 | .num_items = 4, |
| 1951 | .items = { |
| 1952 | { "Mic", 0x0 }, |
| 1953 | { "Line", 0x2 }, |
| 1954 | { "CD", 0x4 }, |
| 1955 | { "Input Mix", 0xa }, |
| 1956 | }, |
| 1957 | } |
| 1958 | }; |
| 1959 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1960 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1961 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1962 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1963 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1964 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1965 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1966 | HDA_OUTPUT), |
| 1967 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1968 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1969 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1970 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1971 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1972 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1973 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1974 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1975 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1976 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1977 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1978 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1979 | { } /* end */ |
| 1980 | }; |
| 1981 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 1982 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 1983 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1984 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1985 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1986 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1987 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1988 | HDA_OUTPUT), |
| 1989 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1990 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1991 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1992 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1993 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1994 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1995 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1996 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1997 | { } /* end */ |
| 1998 | }; |
| 1999 | |
| 2000 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2001 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2002 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2003 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2004 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2005 | spec->autocfg.hp_pins[0] = 0x15; |
| 2006 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 2007 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2008 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2009 | } |
| 2010 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2011 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2012 | { |
| 2013 | struct alc_spec *spec = codec->spec; |
| 2014 | |
| 2015 | spec->autocfg.hp_pins[0] = 0x15; |
| 2016 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2017 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2018 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2019 | } |
| 2020 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2021 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2022 | { |
| 2023 | struct alc_spec *spec = codec->spec; |
| 2024 | |
| 2025 | spec->autocfg.hp_pins[0] = 0x15; |
| 2026 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2027 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2028 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2029 | } |
| 2030 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2031 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2032 | * ALC880 3-stack model |
| 2033 | * |
| 2034 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2035 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 2036 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2037 | */ |
| 2038 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2039 | static hda_nid_t alc880_dac_nids[4] = { |
| 2040 | /* front, rear, clfe, rear_surr */ |
| 2041 | 0x02, 0x05, 0x04, 0x03 |
| 2042 | }; |
| 2043 | |
| 2044 | static hda_nid_t alc880_adc_nids[3] = { |
| 2045 | /* ADC0-2 */ |
| 2046 | 0x07, 0x08, 0x09, |
| 2047 | }; |
| 2048 | |
| 2049 | /* The datasheet says the node 0x07 is connected from inputs, |
| 2050 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2051 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2052 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2053 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 2054 | /* ADC1-2 */ |
| 2055 | 0x08, 0x09, |
| 2056 | }; |
| 2057 | |
| 2058 | #define ALC880_DIGOUT_NID 0x06 |
| 2059 | #define ALC880_DIGIN_NID 0x0a |
| 2060 | |
| 2061 | static struct hda_input_mux alc880_capture_source = { |
| 2062 | .num_items = 4, |
| 2063 | .items = { |
| 2064 | { "Mic", 0x0 }, |
| 2065 | { "Front Mic", 0x3 }, |
| 2066 | { "Line", 0x2 }, |
| 2067 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2068 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2069 | }; |
| 2070 | |
| 2071 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2072 | /* 2ch mode */ |
| 2073 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 2074 | /* set line-in to input, mute it */ |
| 2075 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2076 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2077 | /* set mic-in to input vref 80%, mute it */ |
| 2078 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2079 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2080 | { } /* end */ |
| 2081 | }; |
| 2082 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2083 | /* 6ch mode */ |
| 2084 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 2085 | /* set line-in to output, unmute it */ |
| 2086 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2087 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2088 | /* set mic-in to output, unmute it */ |
| 2089 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2090 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2091 | { } /* end */ |
| 2092 | }; |
| 2093 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2094 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2095 | { 2, alc880_threestack_ch2_init }, |
| 2096 | { 6, alc880_threestack_ch6_init }, |
| 2097 | }; |
| 2098 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2099 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2100 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2101 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2102 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2103 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2104 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2105 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2106 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2107 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2108 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2109 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2110 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2111 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2112 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2113 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2114 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2115 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2116 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2117 | { |
| 2118 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2119 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2120 | .info = alc_ch_mode_info, |
| 2121 | .get = alc_ch_mode_get, |
| 2122 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2123 | }, |
| 2124 | { } /* end */ |
| 2125 | }; |
| 2126 | |
| 2127 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2128 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2129 | struct snd_ctl_elem_info *uinfo) |
| 2130 | { |
| 2131 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2132 | struct alc_spec *spec = codec->spec; |
| 2133 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2134 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2135 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2136 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2137 | HDA_INPUT); |
| 2138 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2139 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2140 | return err; |
| 2141 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2142 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2143 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2144 | unsigned int size, unsigned int __user *tlv) |
| 2145 | { |
| 2146 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2147 | struct alc_spec *spec = codec->spec; |
| 2148 | int err; |
| 2149 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2150 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2151 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2152 | HDA_INPUT); |
| 2153 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2154 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2155 | return err; |
| 2156 | } |
| 2157 | |
| 2158 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2159 | struct snd_ctl_elem_value *ucontrol); |
| 2160 | |
| 2161 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2162 | struct snd_ctl_elem_value *ucontrol, |
| 2163 | getput_call_t func) |
| 2164 | { |
| 2165 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2166 | struct alc_spec *spec = codec->spec; |
| 2167 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2168 | int err; |
| 2169 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2170 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2171 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2172 | 3, 0, HDA_INPUT); |
| 2173 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2174 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2175 | return err; |
| 2176 | } |
| 2177 | |
| 2178 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2179 | struct snd_ctl_elem_value *ucontrol) |
| 2180 | { |
| 2181 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2182 | snd_hda_mixer_amp_volume_get); |
| 2183 | } |
| 2184 | |
| 2185 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2186 | struct snd_ctl_elem_value *ucontrol) |
| 2187 | { |
| 2188 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2189 | snd_hda_mixer_amp_volume_put); |
| 2190 | } |
| 2191 | |
| 2192 | /* capture mixer elements */ |
| 2193 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2194 | |
| 2195 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2196 | struct snd_ctl_elem_value *ucontrol) |
| 2197 | { |
| 2198 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2199 | snd_hda_mixer_amp_switch_get); |
| 2200 | } |
| 2201 | |
| 2202 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2203 | struct snd_ctl_elem_value *ucontrol) |
| 2204 | { |
| 2205 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2206 | snd_hda_mixer_amp_switch_put); |
| 2207 | } |
| 2208 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2209 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2210 | { \ |
| 2211 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2212 | .name = "Capture Switch", \ |
| 2213 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2214 | .count = num, \ |
| 2215 | .info = alc_cap_sw_info, \ |
| 2216 | .get = alc_cap_sw_get, \ |
| 2217 | .put = alc_cap_sw_put, \ |
| 2218 | }, \ |
| 2219 | { \ |
| 2220 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2221 | .name = "Capture Volume", \ |
| 2222 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2223 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2224 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2225 | .count = num, \ |
| 2226 | .info = alc_cap_vol_info, \ |
| 2227 | .get = alc_cap_vol_get, \ |
| 2228 | .put = alc_cap_vol_put, \ |
| 2229 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2230 | } |
| 2231 | |
| 2232 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2233 | { \ |
| 2234 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2235 | /* .name = "Capture Source", */ \ |
| 2236 | .name = "Input Source", \ |
| 2237 | .count = num, \ |
| 2238 | .info = alc_mux_enum_info, \ |
| 2239 | .get = alc_mux_enum_get, \ |
| 2240 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2241 | } |
| 2242 | |
| 2243 | #define DEFINE_CAPMIX(num) \ |
| 2244 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2245 | _DEFINE_CAPMIX(num), \ |
| 2246 | _DEFINE_CAPSRC(num), \ |
| 2247 | { } /* end */ \ |
| 2248 | } |
| 2249 | |
| 2250 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2251 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2252 | _DEFINE_CAPMIX(num), \ |
| 2253 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2254 | } |
| 2255 | |
| 2256 | /* up to three ADCs */ |
| 2257 | DEFINE_CAPMIX(1); |
| 2258 | DEFINE_CAPMIX(2); |
| 2259 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2260 | DEFINE_CAPMIX_NOSRC(1); |
| 2261 | DEFINE_CAPMIX_NOSRC(2); |
| 2262 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2263 | |
| 2264 | /* |
| 2265 | * ALC880 5-stack model |
| 2266 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2267 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2268 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2269 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2270 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2271 | */ |
| 2272 | |
| 2273 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2274 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2275 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2276 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2277 | { } /* end */ |
| 2278 | }; |
| 2279 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2280 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2281 | /* 6ch mode */ |
| 2282 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2283 | /* set line-in to input, mute it */ |
| 2284 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2285 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2286 | { } /* end */ |
| 2287 | }; |
| 2288 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2289 | /* 8ch mode */ |
| 2290 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2291 | /* set line-in to output, unmute it */ |
| 2292 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2293 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2294 | { } /* end */ |
| 2295 | }; |
| 2296 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2297 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2298 | { 6, alc880_fivestack_ch6_init }, |
| 2299 | { 8, alc880_fivestack_ch8_init }, |
| 2300 | }; |
| 2301 | |
| 2302 | |
| 2303 | /* |
| 2304 | * ALC880 6-stack model |
| 2305 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2306 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2307 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2308 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2309 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2310 | */ |
| 2311 | |
| 2312 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2313 | /* front, rear, clfe, rear_surr */ |
| 2314 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2315 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2316 | |
| 2317 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2318 | .num_items = 4, |
| 2319 | .items = { |
| 2320 | { "Mic", 0x0 }, |
| 2321 | { "Front Mic", 0x1 }, |
| 2322 | { "Line", 0x2 }, |
| 2323 | { "CD", 0x4 }, |
| 2324 | }, |
| 2325 | }; |
| 2326 | |
| 2327 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2328 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2329 | { 8, NULL }, |
| 2330 | }; |
| 2331 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2332 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2333 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2334 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2335 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2336 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2337 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2338 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2339 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2340 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2341 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2342 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2343 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2344 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2345 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2346 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2347 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2348 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2349 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2350 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2351 | { |
| 2352 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2353 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2354 | .info = alc_ch_mode_info, |
| 2355 | .get = alc_ch_mode_get, |
| 2356 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2357 | }, |
| 2358 | { } /* end */ |
| 2359 | }; |
| 2360 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2361 | |
| 2362 | /* |
| 2363 | * ALC880 W810 model |
| 2364 | * |
| 2365 | * W810 has rear IO for: |
| 2366 | * Front (DAC 02) |
| 2367 | * Surround (DAC 03) |
| 2368 | * Center/LFE (DAC 04) |
| 2369 | * Digital out (06) |
| 2370 | * |
| 2371 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2372 | * 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] | 2373 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2374 | * There is a variable resistor to control the speaker or headphone |
| 2375 | * volume. This is a hardware-only device without a software API. |
| 2376 | * |
| 2377 | * Plugging headphones in will disable the internal speakers. This is |
| 2378 | * implemented in hardware, not via the driver using jack sense. In |
| 2379 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2380 | * disable both the speakers and headphones. |
| 2381 | * |
| 2382 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2383 | * These may not do anything useful with this driver yet, because I |
| 2384 | * haven't setup any initialization verbs for these yet... |
| 2385 | */ |
| 2386 | |
| 2387 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2388 | /* front, rear/surround, clfe */ |
| 2389 | 0x02, 0x03, 0x04 |
| 2390 | }; |
| 2391 | |
| 2392 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2393 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2394 | { 6, NULL } |
| 2395 | }; |
| 2396 | |
| 2397 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2398 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2399 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2400 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2401 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2402 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2403 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2404 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2405 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2406 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2407 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2408 | { } /* end */ |
| 2409 | }; |
| 2410 | |
| 2411 | |
| 2412 | /* |
| 2413 | * Z710V model |
| 2414 | * |
| 2415 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2416 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2417 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2418 | */ |
| 2419 | |
| 2420 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2421 | 0x02 |
| 2422 | }; |
| 2423 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2424 | |
| 2425 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2426 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2427 | { 2, NULL } |
| 2428 | }; |
| 2429 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2430 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2431 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2432 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2433 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2434 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2435 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2436 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2437 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2438 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2439 | { } /* end */ |
| 2440 | }; |
| 2441 | |
| 2442 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2443 | /* |
| 2444 | * ALC880 F1734 model |
| 2445 | * |
| 2446 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2447 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2448 | */ |
| 2449 | |
| 2450 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2451 | 0x03 |
| 2452 | }; |
| 2453 | #define ALC880_F1734_HP_DAC 0x02 |
| 2454 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2455 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2456 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2457 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2458 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2459 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2460 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2461 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2462 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2463 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2464 | { } /* end */ |
| 2465 | }; |
| 2466 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2467 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2468 | .num_items = 2, |
| 2469 | .items = { |
| 2470 | { "Mic", 0x1 }, |
| 2471 | { "CD", 0x4 }, |
| 2472 | }, |
| 2473 | }; |
| 2474 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2475 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2476 | /* |
| 2477 | * ALC880 ASUS model |
| 2478 | * |
| 2479 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2480 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2481 | * Mic = 0x18, Line = 0x1a |
| 2482 | */ |
| 2483 | |
| 2484 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2485 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2486 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2487 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2488 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2489 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2490 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2491 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2492 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2493 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2494 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2495 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2496 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2497 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2498 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2499 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2500 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2501 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2502 | { |
| 2503 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2504 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2505 | .info = alc_ch_mode_info, |
| 2506 | .get = alc_ch_mode_get, |
| 2507 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2508 | }, |
| 2509 | { } /* end */ |
| 2510 | }; |
| 2511 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2512 | /* |
| 2513 | * ALC880 ASUS W1V model |
| 2514 | * |
| 2515 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2516 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2517 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2518 | */ |
| 2519 | |
| 2520 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2521 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2522 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2523 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2524 | { } /* end */ |
| 2525 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2526 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2527 | /* TCL S700 */ |
| 2528 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2529 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2530 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2531 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2532 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2533 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2534 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2535 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2536 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2537 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2538 | { } /* end */ |
| 2539 | }; |
| 2540 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2541 | /* Uniwill */ |
| 2542 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2543 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2544 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2545 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2546 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2547 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2548 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2549 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2550 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2551 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2552 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2553 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2554 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2555 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2556 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2557 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2558 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2559 | { |
| 2560 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2561 | .name = "Channel Mode", |
| 2562 | .info = alc_ch_mode_info, |
| 2563 | .get = alc_ch_mode_get, |
| 2564 | .put = alc_ch_mode_put, |
| 2565 | }, |
| 2566 | { } /* end */ |
| 2567 | }; |
| 2568 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2569 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2570 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2571 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2572 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2573 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2574 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2575 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2576 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2577 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2578 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2579 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2580 | { } /* end */ |
| 2581 | }; |
| 2582 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2583 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2584 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2585 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2586 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2587 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2588 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2589 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2590 | { } /* end */ |
| 2591 | }; |
| 2592 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2593 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2594 | * virtual master controls |
| 2595 | */ |
| 2596 | |
| 2597 | /* |
| 2598 | * slave controls for virtual master |
| 2599 | */ |
| 2600 | static const char *alc_slave_vols[] = { |
| 2601 | "Front Playback Volume", |
| 2602 | "Surround Playback Volume", |
| 2603 | "Center Playback Volume", |
| 2604 | "LFE Playback Volume", |
| 2605 | "Side Playback Volume", |
| 2606 | "Headphone Playback Volume", |
| 2607 | "Speaker Playback Volume", |
| 2608 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2609 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2610 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2611 | NULL, |
| 2612 | }; |
| 2613 | |
| 2614 | static const char *alc_slave_sws[] = { |
| 2615 | "Front Playback Switch", |
| 2616 | "Surround Playback Switch", |
| 2617 | "Center Playback Switch", |
| 2618 | "LFE Playback Switch", |
| 2619 | "Side Playback Switch", |
| 2620 | "Headphone Playback Switch", |
| 2621 | "Speaker Playback Switch", |
| 2622 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2623 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2624 | "Line-Out Playback Switch", |
| 2625 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2626 | NULL, |
| 2627 | }; |
| 2628 | |
| 2629 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2630 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2631 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2632 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2633 | #define NID_MAPPING (-1) |
| 2634 | |
| 2635 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2636 | #define SUBDEV_HP_ (1 << 6) |
| 2637 | #define SUBDEV_LINE_ (2 << 6) |
| 2638 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2639 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2640 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2641 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2642 | static void alc_free_kctls(struct hda_codec *codec); |
| 2643 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2644 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2645 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2646 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2647 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2648 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2649 | { } /* end */ |
| 2650 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2651 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2652 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2653 | static int alc_build_controls(struct hda_codec *codec) |
| 2654 | { |
| 2655 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 2656 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2657 | struct snd_kcontrol_new *knew; |
| 2658 | int i, j, err; |
| 2659 | unsigned int u; |
| 2660 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2661 | |
| 2662 | for (i = 0; i < spec->num_mixers; i++) { |
| 2663 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2664 | if (err < 0) |
| 2665 | return err; |
| 2666 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2667 | if (spec->cap_mixer) { |
| 2668 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2669 | if (err < 0) |
| 2670 | return err; |
| 2671 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2672 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2673 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2674 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2675 | if (err < 0) |
| 2676 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2677 | if (!spec->no_analog) { |
| 2678 | err = snd_hda_create_spdif_share_sw(codec, |
| 2679 | &spec->multiout); |
| 2680 | if (err < 0) |
| 2681 | return err; |
| 2682 | spec->multiout.share_spdif = 1; |
| 2683 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2684 | } |
| 2685 | if (spec->dig_in_nid) { |
| 2686 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2687 | if (err < 0) |
| 2688 | return err; |
| 2689 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2690 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2691 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2692 | /* create beep controls if needed */ |
| 2693 | if (spec->beep_amp) { |
| 2694 | struct snd_kcontrol_new *knew; |
| 2695 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2696 | struct snd_kcontrol *kctl; |
| 2697 | kctl = snd_ctl_new1(knew, codec); |
| 2698 | if (!kctl) |
| 2699 | return -ENOMEM; |
| 2700 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2701 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2702 | if (err < 0) |
| 2703 | return err; |
| 2704 | } |
| 2705 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2706 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2707 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2708 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2709 | if (!spec->no_analog && |
| 2710 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2711 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2712 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2713 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2714 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2715 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2716 | if (err < 0) |
| 2717 | return err; |
| 2718 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2719 | if (!spec->no_analog && |
| 2720 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2721 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2722 | NULL, alc_slave_sws); |
| 2723 | if (err < 0) |
| 2724 | return err; |
| 2725 | } |
| 2726 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2727 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 2728 | if (spec->capsrc_nids || spec->adc_nids) { |
| 2729 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 2730 | if (!kctl) |
| 2731 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 2732 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2733 | hda_nid_t *nids = spec->capsrc_nids; |
| 2734 | if (!nids) |
| 2735 | nids = spec->adc_nids; |
| 2736 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 2737 | if (err < 0) |
| 2738 | return err; |
| 2739 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2740 | } |
| 2741 | if (spec->cap_mixer) { |
| 2742 | const char *kname = kctl ? kctl->id.name : NULL; |
| 2743 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 2744 | if (kname && strcmp(knew->name, kname) == 0) |
| 2745 | continue; |
| 2746 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2747 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2748 | err = snd_hda_add_nid(codec, kctl, i, |
| 2749 | spec->adc_nids[i]); |
| 2750 | if (err < 0) |
| 2751 | return err; |
| 2752 | } |
| 2753 | } |
| 2754 | } |
| 2755 | |
| 2756 | /* other nid->control mapping */ |
| 2757 | for (i = 0; i < spec->num_mixers; i++) { |
| 2758 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 2759 | if (knew->iface != NID_MAPPING) |
| 2760 | continue; |
| 2761 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2762 | if (kctl == NULL) |
| 2763 | continue; |
| 2764 | u = knew->subdevice; |
| 2765 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2766 | nid = u & 0x3f; |
| 2767 | if (nid == 0) |
| 2768 | continue; |
| 2769 | switch (u & 0xc0) { |
| 2770 | case SUBDEV_SPEAKER_: |
| 2771 | nid = spec->autocfg.speaker_pins[nid]; |
| 2772 | break; |
| 2773 | case SUBDEV_LINE_: |
| 2774 | nid = spec->autocfg.line_out_pins[nid]; |
| 2775 | break; |
| 2776 | case SUBDEV_HP_: |
| 2777 | nid = spec->autocfg.hp_pins[nid]; |
| 2778 | break; |
| 2779 | default: |
| 2780 | continue; |
| 2781 | } |
| 2782 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2783 | if (err < 0) |
| 2784 | return err; |
| 2785 | } |
| 2786 | u = knew->private_value; |
| 2787 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2788 | nid = u & 0xff; |
| 2789 | if (nid == 0) |
| 2790 | continue; |
| 2791 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2792 | if (err < 0) |
| 2793 | return err; |
| 2794 | } |
| 2795 | } |
| 2796 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 2797 | |
| 2798 | alc_free_kctls(codec); /* no longer needed */ |
| 2799 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2800 | return 0; |
| 2801 | } |
| 2802 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2803 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2804 | /* |
| 2805 | * initialize the codec volumes, etc |
| 2806 | */ |
| 2807 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2808 | /* |
| 2809 | * generic initialization of ADC, input mixers and output mixers |
| 2810 | */ |
| 2811 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2812 | /* |
| 2813 | * Unmute ADC0-2 and set the default input to mic-in |
| 2814 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2815 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2816 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2817 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2818 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2819 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2820 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2821 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2822 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2823 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2824 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2825 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2826 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2827 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2828 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2829 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2830 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2831 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2832 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2833 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2834 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2835 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2836 | /* |
| 2837 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2838 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2839 | /* set vol=0 to output mixers */ |
| 2840 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2841 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2842 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2843 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2844 | /* set up input amps for analog loopback */ |
| 2845 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2846 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2847 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2848 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2849 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2850 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2851 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2852 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2853 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2854 | |
| 2855 | { } |
| 2856 | }; |
| 2857 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2858 | /* |
| 2859 | * 3-stack pin configuration: |
| 2860 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2861 | */ |
| 2862 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2863 | /* |
| 2864 | * preset connection lists of input pins |
| 2865 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2866 | */ |
| 2867 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2868 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2869 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2870 | |
| 2871 | /* |
| 2872 | * Set pin mode and muting |
| 2873 | */ |
| 2874 | /* set front pin widgets 0x14 for output */ |
| 2875 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2876 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2877 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2878 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2879 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2880 | /* Mic2 (as headphone out) for HP output */ |
| 2881 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2882 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2883 | /* Line In pin widget for input */ |
| 2884 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2885 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2886 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2887 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2888 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2889 | /* CD pin widget for input */ |
| 2890 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2891 | |
| 2892 | { } |
| 2893 | }; |
| 2894 | |
| 2895 | /* |
| 2896 | * 5-stack pin configuration: |
| 2897 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2898 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2899 | */ |
| 2900 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2901 | /* |
| 2902 | * preset connection lists of input pins |
| 2903 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2904 | */ |
| 2905 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2906 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2907 | |
| 2908 | /* |
| 2909 | * Set pin mode and muting |
| 2910 | */ |
| 2911 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2912 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2913 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2914 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2915 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2916 | /* unmute pins for output (no gain on this amp) */ |
| 2917 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2918 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2919 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2920 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2921 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2922 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2923 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2924 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2925 | /* Mic2 (as headphone out) for HP output */ |
| 2926 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2927 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2928 | /* Line In pin widget for input */ |
| 2929 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2930 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2931 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2932 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2933 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2934 | /* CD pin widget for input */ |
| 2935 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2936 | |
| 2937 | { } |
| 2938 | }; |
| 2939 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2940 | /* |
| 2941 | * W810 pin configuration: |
| 2942 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2943 | */ |
| 2944 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2945 | /* hphone/speaker input selector: front DAC */ |
| 2946 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2947 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2948 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2949 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2950 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2951 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2952 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2953 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2954 | |
| 2955 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2956 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2957 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2958 | { } |
| 2959 | }; |
| 2960 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2961 | /* |
| 2962 | * Z71V pin configuration: |
| 2963 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2964 | */ |
| 2965 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2966 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2967 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2968 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2969 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2970 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2971 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2972 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2973 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2974 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2975 | |
| 2976 | { } |
| 2977 | }; |
| 2978 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2979 | /* |
| 2980 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2981 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2982 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2983 | */ |
| 2984 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2985 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2986 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2987 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2988 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2989 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2990 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2991 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2992 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2993 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2994 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2995 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2996 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2997 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2998 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2999 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3000 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3001 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3002 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3003 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3004 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3005 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3006 | { } |
| 3007 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3008 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3009 | /* |
| 3010 | * Uniwill pin configuration: |
| 3011 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 3012 | * line = 0x1a |
| 3013 | */ |
| 3014 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 3015 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3016 | |
| 3017 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3018 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3019 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3020 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3021 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3022 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3023 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3024 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3025 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3026 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3027 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3028 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3029 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3030 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3031 | |
| 3032 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3033 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3034 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3035 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3036 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3037 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3038 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 3039 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 3040 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3041 | |
| 3042 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3043 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 3044 | |
| 3045 | { } |
| 3046 | }; |
| 3047 | |
| 3048 | /* |
| 3049 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3050 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3051 | */ |
| 3052 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 3053 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3054 | |
| 3055 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3056 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3057 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3058 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3059 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3060 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3061 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3062 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3063 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3064 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3065 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3066 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3067 | |
| 3068 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3069 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3070 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3071 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3072 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3073 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3074 | |
| 3075 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3076 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3077 | |
| 3078 | { } |
| 3079 | }; |
| 3080 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3081 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 3082 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3083 | { } |
| 3084 | }; |
| 3085 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3086 | /* auto-toggle front mic */ |
| 3087 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 3088 | { |
| 3089 | unsigned int present; |
| 3090 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3091 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3092 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3093 | bits = present ? HDA_AMP_MUTE : 0; |
| 3094 | 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] | 3095 | } |
| 3096 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3097 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3098 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3099 | struct alc_spec *spec = codec->spec; |
| 3100 | |
| 3101 | spec->autocfg.hp_pins[0] = 0x14; |
| 3102 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3103 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3104 | } |
| 3105 | |
| 3106 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3107 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3108 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3109 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3110 | } |
| 3111 | |
| 3112 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3113 | unsigned int res) |
| 3114 | { |
| 3115 | /* Looks like the unsol event is incompatible with the standard |
| 3116 | * definition. 4bit tag is placed at 28 bit! |
| 3117 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3118 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3119 | case ALC880_MIC_EVENT: |
| 3120 | alc880_uniwill_mic_automute(codec); |
| 3121 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3122 | default: |
| 3123 | alc_automute_amp_unsol_event(codec, res); |
| 3124 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3125 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3126 | } |
| 3127 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3128 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3129 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3130 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3131 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3132 | spec->autocfg.hp_pins[0] = 0x14; |
| 3133 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3134 | } |
| 3135 | |
| 3136 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3137 | { |
| 3138 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3139 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3140 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3141 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3142 | present &= HDA_AMP_VOLMASK; |
| 3143 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3144 | HDA_AMP_VOLMASK, present); |
| 3145 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3146 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3147 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3148 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3149 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3150 | unsigned int res) |
| 3151 | { |
| 3152 | /* Looks like the unsol event is incompatible with the standard |
| 3153 | * definition. 4bit tag is placed at 28 bit! |
| 3154 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3155 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3156 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3157 | else |
| 3158 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3159 | } |
| 3160 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3161 | /* |
| 3162 | * F1734 pin configuration: |
| 3163 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3164 | */ |
| 3165 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3166 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3167 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3168 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3169 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3170 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3171 | |
| 3172 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3173 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3174 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3175 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3176 | |
| 3177 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3178 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3179 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3180 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3181 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3182 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3183 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3184 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3185 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3186 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3187 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3188 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3189 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3190 | { } |
| 3191 | }; |
| 3192 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3193 | /* |
| 3194 | * ASUS pin configuration: |
| 3195 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3196 | */ |
| 3197 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3198 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3199 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3200 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3201 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3202 | |
| 3203 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3204 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3205 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3206 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3207 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3208 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3209 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3210 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3211 | |
| 3212 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3213 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3214 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3215 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3216 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3217 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3218 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3219 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3220 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3221 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3222 | { } |
| 3223 | }; |
| 3224 | |
| 3225 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3226 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3227 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3228 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3229 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3230 | /* Clevo m520g init */ |
| 3231 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3232 | /* headphone output */ |
| 3233 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3234 | /* line-out */ |
| 3235 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3236 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3237 | /* Line-in */ |
| 3238 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3239 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3240 | /* CD */ |
| 3241 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3242 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3243 | /* Mic1 (rear panel) */ |
| 3244 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3245 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3246 | /* Mic2 (front panel) */ |
| 3247 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3248 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3249 | /* headphone */ |
| 3250 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3251 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3252 | /* change to EAPD mode */ |
| 3253 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3254 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3255 | |
| 3256 | { } |
| 3257 | }; |
| 3258 | |
| 3259 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3260 | /* change to EAPD mode */ |
| 3261 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3262 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3263 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3264 | /* Headphone output */ |
| 3265 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3266 | /* Front output*/ |
| 3267 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3268 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3269 | |
| 3270 | /* Line In pin widget for input */ |
| 3271 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3272 | /* CD pin widget for input */ |
| 3273 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3274 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3275 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3276 | |
| 3277 | /* change to EAPD mode */ |
| 3278 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3279 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3280 | |
| 3281 | { } |
| 3282 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3283 | |
| 3284 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3285 | * LG m1 express dual |
| 3286 | * |
| 3287 | * Pin assignment: |
| 3288 | * Rear Line-In/Out (blue): 0x14 |
| 3289 | * Build-in Mic-In: 0x15 |
| 3290 | * Speaker-out: 0x17 |
| 3291 | * HP-Out (green): 0x1b |
| 3292 | * Mic-In/Out (red): 0x19 |
| 3293 | * SPDIF-Out: 0x1e |
| 3294 | */ |
| 3295 | |
| 3296 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3297 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3298 | 0x05, 0x02, 0x03 |
| 3299 | }; |
| 3300 | |
| 3301 | /* seems analog CD is not working */ |
| 3302 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3303 | .num_items = 3, |
| 3304 | .items = { |
| 3305 | { "Mic", 0x1 }, |
| 3306 | { "Line", 0x5 }, |
| 3307 | { "Internal Mic", 0x6 }, |
| 3308 | }, |
| 3309 | }; |
| 3310 | |
| 3311 | /* 2,4,6 channel modes */ |
| 3312 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3313 | /* set line-in and mic-in to input */ |
| 3314 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3315 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3316 | { } |
| 3317 | }; |
| 3318 | |
| 3319 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3320 | /* set line-in to out and mic-in to input */ |
| 3321 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3322 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3323 | { } |
| 3324 | }; |
| 3325 | |
| 3326 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3327 | /* set line-in and mic-in to output */ |
| 3328 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3329 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3330 | { } |
| 3331 | }; |
| 3332 | |
| 3333 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3334 | { 2, alc880_lg_ch2_init }, |
| 3335 | { 4, alc880_lg_ch4_init }, |
| 3336 | { 6, alc880_lg_ch6_init }, |
| 3337 | }; |
| 3338 | |
| 3339 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3340 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3341 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3342 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3343 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3344 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3345 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3346 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3347 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3348 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3349 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3350 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3351 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3352 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3353 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3354 | { |
| 3355 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3356 | .name = "Channel Mode", |
| 3357 | .info = alc_ch_mode_info, |
| 3358 | .get = alc_ch_mode_get, |
| 3359 | .put = alc_ch_mode_put, |
| 3360 | }, |
| 3361 | { } /* end */ |
| 3362 | }; |
| 3363 | |
| 3364 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3365 | /* set capture source to mic-in */ |
| 3366 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3367 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3368 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3369 | /* mute all amp mixer inputs */ |
| 3370 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3371 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3372 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3373 | /* line-in to input */ |
| 3374 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3375 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3376 | /* built-in mic */ |
| 3377 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3378 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3379 | /* speaker-out */ |
| 3380 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3381 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3382 | /* mic-in to input */ |
| 3383 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3384 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3385 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3386 | /* HP-out */ |
| 3387 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3388 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3389 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3390 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3391 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3392 | { } |
| 3393 | }; |
| 3394 | |
| 3395 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3396 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3397 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3398 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3399 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3400 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3401 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3402 | } |
| 3403 | |
| 3404 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3405 | * LG LW20 |
| 3406 | * |
| 3407 | * Pin assignment: |
| 3408 | * Speaker-out: 0x14 |
| 3409 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3410 | * Built-in Mic-In: 0x19 |
| 3411 | * Line-In: 0x1b |
| 3412 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3413 | * SPDIF-Out: 0x1e |
| 3414 | */ |
| 3415 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3416 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3417 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3418 | .items = { |
| 3419 | { "Mic", 0x0 }, |
| 3420 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3421 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3422 | }, |
| 3423 | }; |
| 3424 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3425 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3426 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3427 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3428 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3429 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3430 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3431 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3432 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3433 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3434 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3435 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3436 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3437 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3438 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3439 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3440 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3441 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3442 | { |
| 3443 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3444 | .name = "Channel Mode", |
| 3445 | .info = alc_ch_mode_info, |
| 3446 | .get = alc_ch_mode_get, |
| 3447 | .put = alc_ch_mode_put, |
| 3448 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3449 | { } /* end */ |
| 3450 | }; |
| 3451 | |
| 3452 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3453 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3454 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3455 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3456 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3457 | /* set capture source to mic-in */ |
| 3458 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3459 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3460 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3461 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3462 | /* speaker-out */ |
| 3463 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3464 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3465 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3466 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3467 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3468 | /* mic-in to input */ |
| 3469 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3470 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3471 | /* built-in mic */ |
| 3472 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3473 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3474 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3475 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3476 | { } |
| 3477 | }; |
| 3478 | |
| 3479 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3480 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3481 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3482 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3483 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3484 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3485 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3486 | } |
| 3487 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3488 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3489 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3490 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3491 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3492 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3493 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3494 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3495 | { } /* end */ |
| 3496 | }; |
| 3497 | |
| 3498 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3499 | .num_items = 2, |
| 3500 | .items = { |
| 3501 | { "Mic", 0x0 }, |
| 3502 | { "Internal Mic", 0x1 }, |
| 3503 | }, |
| 3504 | }; |
| 3505 | |
| 3506 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3507 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3508 | |
| 3509 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3510 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3511 | |
| 3512 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3513 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3514 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3515 | /* Mic2 (as headphone out) for HP output */ |
| 3516 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3517 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3518 | /* Internal Speaker */ |
| 3519 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3520 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3521 | |
| 3522 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3523 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3524 | |
| 3525 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3526 | { } |
| 3527 | }; |
| 3528 | |
| 3529 | /* toggle speaker-output according to the hp-jack state */ |
| 3530 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3531 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3532 | struct alc_spec *spec = codec->spec; |
| 3533 | alc_automute_amp(codec); |
| 3534 | /* toggle EAPD */ |
| 3535 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3536 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3537 | else |
| 3538 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3539 | } |
| 3540 | |
| 3541 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3542 | unsigned int res) |
| 3543 | { |
| 3544 | /* Looks like the unsol event is incompatible with the standard |
| 3545 | * definition. 4bit tag is placed at 28 bit! |
| 3546 | */ |
| 3547 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3548 | alc880_medion_rim_automute(codec); |
| 3549 | } |
| 3550 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3551 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3552 | { |
| 3553 | struct alc_spec *spec = codec->spec; |
| 3554 | |
| 3555 | spec->autocfg.hp_pins[0] = 0x14; |
| 3556 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3557 | } |
| 3558 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3559 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3560 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3561 | { 0x0b, HDA_INPUT, 0 }, |
| 3562 | { 0x0b, HDA_INPUT, 1 }, |
| 3563 | { 0x0b, HDA_INPUT, 2 }, |
| 3564 | { 0x0b, HDA_INPUT, 3 }, |
| 3565 | { 0x0b, HDA_INPUT, 4 }, |
| 3566 | { } /* end */ |
| 3567 | }; |
| 3568 | |
| 3569 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3570 | { 0x0b, HDA_INPUT, 1 }, |
| 3571 | { 0x0b, HDA_INPUT, 6 }, |
| 3572 | { 0x0b, HDA_INPUT, 7 }, |
| 3573 | { } /* end */ |
| 3574 | }; |
| 3575 | #endif |
| 3576 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3577 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3578 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3579 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3580 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3581 | static int alc_init(struct hda_codec *codec) |
| 3582 | { |
| 3583 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3584 | unsigned int i; |
| 3585 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3586 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3587 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3588 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3589 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3590 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3591 | |
| 3592 | if (spec->init_hook) |
| 3593 | spec->init_hook(codec); |
| 3594 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 3595 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3596 | if (codec->patch_ops.check_power_status) |
| 3597 | codec->patch_ops.check_power_status(codec, 0x01); |
| 3598 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3599 | return 0; |
| 3600 | } |
| 3601 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3602 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3603 | { |
| 3604 | struct alc_spec *spec = codec->spec; |
| 3605 | |
| 3606 | if (spec->unsol_event) |
| 3607 | spec->unsol_event(codec, res); |
| 3608 | } |
| 3609 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3610 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3611 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3612 | { |
| 3613 | struct alc_spec *spec = codec->spec; |
| 3614 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3615 | } |
| 3616 | #endif |
| 3617 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3618 | /* |
| 3619 | * Analog playback callbacks |
| 3620 | */ |
| 3621 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3622 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3623 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3624 | { |
| 3625 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3626 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3627 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3628 | } |
| 3629 | |
| 3630 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3631 | struct hda_codec *codec, |
| 3632 | unsigned int stream_tag, |
| 3633 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3634 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3635 | { |
| 3636 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3637 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3638 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3639 | } |
| 3640 | |
| 3641 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3642 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3643 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3644 | { |
| 3645 | struct alc_spec *spec = codec->spec; |
| 3646 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3647 | } |
| 3648 | |
| 3649 | /* |
| 3650 | * Digital out |
| 3651 | */ |
| 3652 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3653 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3654 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3655 | { |
| 3656 | struct alc_spec *spec = codec->spec; |
| 3657 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3658 | } |
| 3659 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3660 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3661 | struct hda_codec *codec, |
| 3662 | unsigned int stream_tag, |
| 3663 | unsigned int format, |
| 3664 | struct snd_pcm_substream *substream) |
| 3665 | { |
| 3666 | struct alc_spec *spec = codec->spec; |
| 3667 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3668 | stream_tag, format, substream); |
| 3669 | } |
| 3670 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3671 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3672 | struct hda_codec *codec, |
| 3673 | struct snd_pcm_substream *substream) |
| 3674 | { |
| 3675 | struct alc_spec *spec = codec->spec; |
| 3676 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3677 | } |
| 3678 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3679 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3680 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3681 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3682 | { |
| 3683 | struct alc_spec *spec = codec->spec; |
| 3684 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3685 | } |
| 3686 | |
| 3687 | /* |
| 3688 | * Analog capture |
| 3689 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3690 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3691 | struct hda_codec *codec, |
| 3692 | unsigned int stream_tag, |
| 3693 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3694 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3695 | { |
| 3696 | struct alc_spec *spec = codec->spec; |
| 3697 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3698 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3699 | stream_tag, 0, format); |
| 3700 | return 0; |
| 3701 | } |
| 3702 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3703 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3704 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3705 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3706 | { |
| 3707 | struct alc_spec *spec = codec->spec; |
| 3708 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3709 | snd_hda_codec_cleanup_stream(codec, |
| 3710 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3711 | return 0; |
| 3712 | } |
| 3713 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 3714 | /* analog capture with dynamic dual-adc changes */ |
| 3715 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3716 | struct hda_codec *codec, |
| 3717 | unsigned int stream_tag, |
| 3718 | unsigned int format, |
| 3719 | struct snd_pcm_substream *substream) |
| 3720 | { |
| 3721 | struct alc_spec *spec = codec->spec; |
| 3722 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 3723 | spec->cur_adc_stream_tag = stream_tag; |
| 3724 | spec->cur_adc_format = format; |
| 3725 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 3726 | return 0; |
| 3727 | } |
| 3728 | |
| 3729 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3730 | struct hda_codec *codec, |
| 3731 | struct snd_pcm_substream *substream) |
| 3732 | { |
| 3733 | struct alc_spec *spec = codec->spec; |
| 3734 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 3735 | spec->cur_adc = 0; |
| 3736 | return 0; |
| 3737 | } |
| 3738 | |
| 3739 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { |
| 3740 | .substreams = 1, |
| 3741 | .channels_min = 2, |
| 3742 | .channels_max = 2, |
| 3743 | .nid = 0, /* fill later */ |
| 3744 | .ops = { |
| 3745 | .prepare = dualmic_capture_pcm_prepare, |
| 3746 | .cleanup = dualmic_capture_pcm_cleanup |
| 3747 | }, |
| 3748 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3749 | |
| 3750 | /* |
| 3751 | */ |
| 3752 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3753 | .substreams = 1, |
| 3754 | .channels_min = 2, |
| 3755 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3756 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3757 | .ops = { |
| 3758 | .open = alc880_playback_pcm_open, |
| 3759 | .prepare = alc880_playback_pcm_prepare, |
| 3760 | .cleanup = alc880_playback_pcm_cleanup |
| 3761 | }, |
| 3762 | }; |
| 3763 | |
| 3764 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3765 | .substreams = 1, |
| 3766 | .channels_min = 2, |
| 3767 | .channels_max = 2, |
| 3768 | /* NID is set in alc_build_pcms */ |
| 3769 | }; |
| 3770 | |
| 3771 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3772 | .substreams = 1, |
| 3773 | .channels_min = 2, |
| 3774 | .channels_max = 2, |
| 3775 | /* NID is set in alc_build_pcms */ |
| 3776 | }; |
| 3777 | |
| 3778 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3779 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3780 | .channels_min = 2, |
| 3781 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3782 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3783 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3784 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3785 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3786 | }, |
| 3787 | }; |
| 3788 | |
| 3789 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3790 | .substreams = 1, |
| 3791 | .channels_min = 2, |
| 3792 | .channels_max = 2, |
| 3793 | /* NID is set in alc_build_pcms */ |
| 3794 | .ops = { |
| 3795 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3796 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3797 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3798 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3799 | }, |
| 3800 | }; |
| 3801 | |
| 3802 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3803 | .substreams = 1, |
| 3804 | .channels_min = 2, |
| 3805 | .channels_max = 2, |
| 3806 | /* NID is set in alc_build_pcms */ |
| 3807 | }; |
| 3808 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3809 | /* 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] | 3810 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3811 | .substreams = 0, |
| 3812 | .channels_min = 0, |
| 3813 | .channels_max = 0, |
| 3814 | }; |
| 3815 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3816 | static int alc_build_pcms(struct hda_codec *codec) |
| 3817 | { |
| 3818 | struct alc_spec *spec = codec->spec; |
| 3819 | struct hda_pcm *info = spec->pcm_rec; |
| 3820 | int i; |
| 3821 | |
| 3822 | codec->num_pcms = 1; |
| 3823 | codec->pcm_info = info; |
| 3824 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3825 | if (spec->no_analog) |
| 3826 | goto skip_analog; |
| 3827 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3828 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3829 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3830 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 3831 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3832 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3833 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3834 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3835 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3836 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3837 | } |
| 3838 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3839 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3840 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3841 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3842 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3843 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3844 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3845 | if (spec->channel_mode) { |
| 3846 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3847 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3848 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3849 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3850 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3851 | } |
| 3852 | } |
| 3853 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3854 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3855 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3856 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3857 | snprintf(spec->stream_name_digital, |
| 3858 | sizeof(spec->stream_name_digital), |
| 3859 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3860 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3861 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3862 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3863 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3864 | if (spec->dig_out_type) |
| 3865 | info->pcm_type = spec->dig_out_type; |
| 3866 | else |
| 3867 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3868 | if (spec->multiout.dig_out_nid && |
| 3869 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3870 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3871 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3872 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3873 | if (spec->dig_in_nid && |
| 3874 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3875 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3876 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3877 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3878 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3879 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3880 | } |
| 3881 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3882 | if (spec->no_analog) |
| 3883 | return 0; |
| 3884 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3885 | /* If the use of more than one ADC is requested for the current |
| 3886 | * model, configure a second analog capture-only PCM. |
| 3887 | */ |
| 3888 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3889 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3890 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3891 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3892 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3893 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3894 | if (spec->alt_dac_nid) { |
| 3895 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3896 | *spec->stream_analog_alt_playback; |
| 3897 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3898 | spec->alt_dac_nid; |
| 3899 | } else { |
| 3900 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3901 | alc_pcm_null_stream; |
| 3902 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3903 | } |
| 3904 | if (spec->num_adc_nids > 1) { |
| 3905 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3906 | *spec->stream_analog_alt_capture; |
| 3907 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3908 | spec->adc_nids[1]; |
| 3909 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3910 | spec->num_adc_nids - 1; |
| 3911 | } else { |
| 3912 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3913 | alc_pcm_null_stream; |
| 3914 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3915 | } |
| 3916 | } |
| 3917 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3918 | return 0; |
| 3919 | } |
| 3920 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3921 | static inline void alc_shutup(struct hda_codec *codec) |
| 3922 | { |
| 3923 | snd_hda_shutup_pins(codec); |
| 3924 | } |
| 3925 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3926 | static void alc_free_kctls(struct hda_codec *codec) |
| 3927 | { |
| 3928 | struct alc_spec *spec = codec->spec; |
| 3929 | |
| 3930 | if (spec->kctls.list) { |
| 3931 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3932 | int i; |
| 3933 | for (i = 0; i < spec->kctls.used; i++) |
| 3934 | kfree(kctl[i].name); |
| 3935 | } |
| 3936 | snd_array_free(&spec->kctls); |
| 3937 | } |
| 3938 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3939 | static void alc_free(struct hda_codec *codec) |
| 3940 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3941 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3942 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3943 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3944 | return; |
| 3945 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3946 | alc_shutup(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3947 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3948 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3949 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3950 | } |
| 3951 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3952 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3953 | static void alc_power_eapd(struct hda_codec *codec) |
| 3954 | { |
| 3955 | /* We currently only handle front, HP */ |
| 3956 | switch (codec->vendor_id) { |
| 3957 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3958 | set_eapd(codec, 0x0f, 0); |
| 3959 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3960 | break; |
| 3961 | case 0x10ec0262: |
| 3962 | case 0x10ec0267: |
| 3963 | case 0x10ec0268: |
| 3964 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3965 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3966 | case 0x10ec0272: |
| 3967 | case 0x10ec0660: |
| 3968 | case 0x10ec0662: |
| 3969 | case 0x10ec0663: |
| 3970 | case 0x10ec0862: |
| 3971 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3972 | set_eapd(codec, 0x14, 0); |
| 3973 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3974 | break; |
| 3975 | } |
| 3976 | } |
| 3977 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3978 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 3979 | { |
| 3980 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3981 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3982 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3983 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3984 | return 0; |
| 3985 | } |
| 3986 | #endif |
| 3987 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3988 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3989 | static int alc_resume(struct hda_codec *codec) |
| 3990 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3991 | codec->patch_ops.init(codec); |
| 3992 | snd_hda_codec_resume_amp(codec); |
| 3993 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 3994 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3995 | if (codec->patch_ops.check_power_status) |
| 3996 | codec->patch_ops.check_power_status(codec, 0x01); |
| 3997 | #endif |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3998 | return 0; |
| 3999 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4000 | #endif |
| 4001 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4002 | /* |
| 4003 | */ |
| 4004 | static struct hda_codec_ops alc_patch_ops = { |
| 4005 | .build_controls = alc_build_controls, |
| 4006 | .build_pcms = alc_build_pcms, |
| 4007 | .init = alc_init, |
| 4008 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4009 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4010 | #ifdef SND_HDA_NEEDS_RESUME |
| 4011 | .resume = alc_resume, |
| 4012 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4013 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4014 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4015 | .check_power_status = alc_check_power_status, |
| 4016 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4017 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4018 | }; |
| 4019 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 4020 | /* replace the codec chip_name with the given string */ |
| 4021 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 4022 | { |
| 4023 | kfree(codec->chip_name); |
| 4024 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 4025 | if (!codec->chip_name) { |
| 4026 | alc_free(codec); |
| 4027 | return -ENOMEM; |
| 4028 | } |
| 4029 | return 0; |
| 4030 | } |
| 4031 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4032 | /* |
| 4033 | * Test configuration for debugging |
| 4034 | * |
| 4035 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 4036 | * enum controls. |
| 4037 | */ |
| 4038 | #ifdef CONFIG_SND_DEBUG |
| 4039 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 4040 | 0x02, 0x03, 0x04, 0x05 |
| 4041 | }; |
| 4042 | |
| 4043 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4044 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4045 | .items = { |
| 4046 | { "In-1", 0x0 }, |
| 4047 | { "In-2", 0x1 }, |
| 4048 | { "In-3", 0x2 }, |
| 4049 | { "In-4", 0x3 }, |
| 4050 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4051 | { "Front", 0x5 }, |
| 4052 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4053 | }, |
| 4054 | }; |
| 4055 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4056 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4057 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4058 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4059 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4060 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4061 | }; |
| 4062 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4063 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4064 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4065 | { |
| 4066 | static char *texts[] = { |
| 4067 | "N/A", "Line Out", "HP Out", |
| 4068 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4069 | }; |
| 4070 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4071 | uinfo->count = 1; |
| 4072 | uinfo->value.enumerated.items = 8; |
| 4073 | if (uinfo->value.enumerated.item >= 8) |
| 4074 | uinfo->value.enumerated.item = 7; |
| 4075 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4076 | return 0; |
| 4077 | } |
| 4078 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4079 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4080 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4081 | { |
| 4082 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4083 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4084 | unsigned int pin_ctl, item = 0; |
| 4085 | |
| 4086 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4087 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4088 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4089 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4090 | item = 2; |
| 4091 | else |
| 4092 | item = 1; |
| 4093 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4094 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4095 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4096 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4097 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4098 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4099 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4100 | } |
| 4101 | } |
| 4102 | ucontrol->value.enumerated.item[0] = item; |
| 4103 | return 0; |
| 4104 | } |
| 4105 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4106 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4107 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4108 | { |
| 4109 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4110 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4111 | static unsigned int ctls[] = { |
| 4112 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4113 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4114 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4115 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4116 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4117 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4118 | }; |
| 4119 | unsigned int old_ctl, new_ctl; |
| 4120 | |
| 4121 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4122 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4123 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4124 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4125 | int val; |
| 4126 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4127 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4128 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4129 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4130 | HDA_AMP_MUTE : 0; |
| 4131 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4132 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4133 | return 1; |
| 4134 | } |
| 4135 | return 0; |
| 4136 | } |
| 4137 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4138 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4139 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4140 | { |
| 4141 | static char *texts[] = { |
| 4142 | "Front", "Surround", "CLFE", "Side" |
| 4143 | }; |
| 4144 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4145 | uinfo->count = 1; |
| 4146 | uinfo->value.enumerated.items = 4; |
| 4147 | if (uinfo->value.enumerated.item >= 4) |
| 4148 | uinfo->value.enumerated.item = 3; |
| 4149 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4150 | return 0; |
| 4151 | } |
| 4152 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4153 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4154 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4155 | { |
| 4156 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4157 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4158 | unsigned int sel; |
| 4159 | |
| 4160 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4161 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4162 | return 0; |
| 4163 | } |
| 4164 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4165 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4166 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4167 | { |
| 4168 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4169 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4170 | unsigned int sel; |
| 4171 | |
| 4172 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4173 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4174 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4175 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4176 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4177 | return 1; |
| 4178 | } |
| 4179 | return 0; |
| 4180 | } |
| 4181 | |
| 4182 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4183 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4184 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4185 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4186 | .info = alc_test_pin_ctl_info, \ |
| 4187 | .get = alc_test_pin_ctl_get, \ |
| 4188 | .put = alc_test_pin_ctl_put, \ |
| 4189 | .private_value = nid \ |
| 4190 | } |
| 4191 | |
| 4192 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4193 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4194 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4195 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4196 | .info = alc_test_pin_src_info, \ |
| 4197 | .get = alc_test_pin_src_get, \ |
| 4198 | .put = alc_test_pin_src_put, \ |
| 4199 | .private_value = nid \ |
| 4200 | } |
| 4201 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4202 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4203 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4204 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4205 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4206 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4207 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4208 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4209 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4210 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4211 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4212 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4213 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4214 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4215 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4216 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4217 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4218 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4219 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4220 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4221 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4222 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4223 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4224 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4225 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4226 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4227 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4228 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4229 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4230 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4231 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4232 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4233 | { |
| 4234 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4235 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4236 | .info = alc_ch_mode_info, |
| 4237 | .get = alc_ch_mode_get, |
| 4238 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4239 | }, |
| 4240 | { } /* end */ |
| 4241 | }; |
| 4242 | |
| 4243 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4244 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4245 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4246 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4247 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4248 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4249 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4250 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4251 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4252 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4253 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4254 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4255 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4256 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4257 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4258 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4259 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4260 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4261 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4262 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4263 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4264 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4265 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4266 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4267 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4268 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4269 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4270 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4271 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4272 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4273 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4274 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4275 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4276 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4277 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4278 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4279 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4280 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4281 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4282 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4283 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4284 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4285 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4286 | /* Analog input/passthru */ |
| 4287 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4288 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4289 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4290 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4291 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4292 | { } |
| 4293 | }; |
| 4294 | #endif |
| 4295 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4296 | /* |
| 4297 | */ |
| 4298 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4299 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 4300 | [ALC880_3ST] = "3stack", |
| 4301 | [ALC880_TCL_S700] = "tcl", |
| 4302 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4303 | [ALC880_CLEVO] = "clevo", |
| 4304 | [ALC880_5ST] = "5stack", |
| 4305 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4306 | [ALC880_W810] = "w810", |
| 4307 | [ALC880_Z71V] = "z71v", |
| 4308 | [ALC880_6ST] = "6stack", |
| 4309 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4310 | [ALC880_ASUS] = "asus", |
| 4311 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4312 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4313 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4314 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4315 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4316 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4317 | [ALC880_F1734] = "F1734", |
| 4318 | [ALC880_LG] = "lg", |
| 4319 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4320 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4321 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4322 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4323 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4324 | [ALC880_AUTO] = "auto", |
| 4325 | }; |
| 4326 | |
| 4327 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4328 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4329 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4330 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4331 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4332 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4333 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4334 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4335 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4336 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4337 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4338 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4339 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4340 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4341 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4342 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4343 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4344 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4345 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4346 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4347 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4348 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4349 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4350 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4351 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4352 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4353 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4354 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4355 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4356 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4357 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4358 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4359 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4360 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4361 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4362 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4363 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4364 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4365 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4366 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4367 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4368 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4369 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4370 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4371 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4372 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4373 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4374 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4375 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4376 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4377 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4378 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4379 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4380 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 4381 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4382 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4383 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4384 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4385 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4386 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4387 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4388 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4389 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4390 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4391 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4392 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4393 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4394 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4395 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4396 | /* default Intel */ |
| 4397 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4398 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4399 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4400 | {} |
| 4401 | }; |
| 4402 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4403 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4404 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4405 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4406 | static struct alc_config_preset alc880_presets[] = { |
| 4407 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4408 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4409 | .init_verbs = { alc880_volume_init_verbs, |
| 4410 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4411 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4412 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4413 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4414 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4415 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4416 | .input_mux = &alc880_capture_source, |
| 4417 | }, |
| 4418 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4419 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4420 | .init_verbs = { alc880_volume_init_verbs, |
| 4421 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4422 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4423 | .dac_nids = alc880_dac_nids, |
| 4424 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4425 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4426 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4427 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4428 | .input_mux = &alc880_capture_source, |
| 4429 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4430 | [ALC880_TCL_S700] = { |
| 4431 | .mixers = { alc880_tcl_s700_mixer }, |
| 4432 | .init_verbs = { alc880_volume_init_verbs, |
| 4433 | alc880_pin_tcl_S700_init_verbs, |
| 4434 | alc880_gpio2_init_verbs }, |
| 4435 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4436 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4437 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4438 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4439 | .hp_nid = 0x03, |
| 4440 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4441 | .channel_mode = alc880_2_jack_modes, |
| 4442 | .input_mux = &alc880_capture_source, |
| 4443 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4444 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4445 | .mixers = { alc880_three_stack_mixer, |
| 4446 | alc880_five_stack_mixer}, |
| 4447 | .init_verbs = { alc880_volume_init_verbs, |
| 4448 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4449 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4450 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4451 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4452 | .channel_mode = alc880_fivestack_modes, |
| 4453 | .input_mux = &alc880_capture_source, |
| 4454 | }, |
| 4455 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4456 | .mixers = { alc880_three_stack_mixer, |
| 4457 | alc880_five_stack_mixer }, |
| 4458 | .init_verbs = { alc880_volume_init_verbs, |
| 4459 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4460 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4461 | .dac_nids = alc880_dac_nids, |
| 4462 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4463 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4464 | .channel_mode = alc880_fivestack_modes, |
| 4465 | .input_mux = &alc880_capture_source, |
| 4466 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4467 | [ALC880_6ST] = { |
| 4468 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4469 | .init_verbs = { alc880_volume_init_verbs, |
| 4470 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4471 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4472 | .dac_nids = alc880_6st_dac_nids, |
| 4473 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4474 | .channel_mode = alc880_sixstack_modes, |
| 4475 | .input_mux = &alc880_6stack_capture_source, |
| 4476 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4477 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4478 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4479 | .init_verbs = { alc880_volume_init_verbs, |
| 4480 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4481 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4482 | .dac_nids = alc880_6st_dac_nids, |
| 4483 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4484 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4485 | .channel_mode = alc880_sixstack_modes, |
| 4486 | .input_mux = &alc880_6stack_capture_source, |
| 4487 | }, |
| 4488 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4489 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4490 | .init_verbs = { alc880_volume_init_verbs, |
| 4491 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4492 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4493 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4494 | .dac_nids = alc880_w810_dac_nids, |
| 4495 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4496 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4497 | .channel_mode = alc880_w810_modes, |
| 4498 | .input_mux = &alc880_capture_source, |
| 4499 | }, |
| 4500 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4501 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4502 | .init_verbs = { alc880_volume_init_verbs, |
| 4503 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4504 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4505 | .dac_nids = alc880_z71v_dac_nids, |
| 4506 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4507 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4508 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4509 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4510 | .input_mux = &alc880_capture_source, |
| 4511 | }, |
| 4512 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4513 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4514 | .init_verbs = { alc880_volume_init_verbs, |
| 4515 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4516 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4517 | .dac_nids = alc880_f1734_dac_nids, |
| 4518 | .hp_nid = 0x02, |
| 4519 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4520 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4521 | .input_mux = &alc880_f1734_capture_source, |
| 4522 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4523 | .setup = alc880_uniwill_p53_setup, |
| 4524 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4525 | }, |
| 4526 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4527 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4528 | .init_verbs = { alc880_volume_init_verbs, |
| 4529 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4530 | alc880_gpio1_init_verbs }, |
| 4531 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4532 | .dac_nids = alc880_asus_dac_nids, |
| 4533 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4534 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4535 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4536 | .input_mux = &alc880_capture_source, |
| 4537 | }, |
| 4538 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4539 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4540 | .init_verbs = { alc880_volume_init_verbs, |
| 4541 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4542 | alc880_gpio1_init_verbs }, |
| 4543 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4544 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4545 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4546 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4547 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4548 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4549 | .input_mux = &alc880_capture_source, |
| 4550 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4551 | [ALC880_ASUS_DIG2] = { |
| 4552 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4553 | .init_verbs = { alc880_volume_init_verbs, |
| 4554 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4555 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4556 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4557 | .dac_nids = alc880_asus_dac_nids, |
| 4558 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4559 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4560 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4561 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4562 | .input_mux = &alc880_capture_source, |
| 4563 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4564 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4565 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4566 | .init_verbs = { alc880_volume_init_verbs, |
| 4567 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4568 | alc880_gpio1_init_verbs }, |
| 4569 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4570 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4571 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4572 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4573 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4574 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4575 | .input_mux = &alc880_capture_source, |
| 4576 | }, |
| 4577 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4578 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4579 | .init_verbs = { alc880_volume_init_verbs, |
| 4580 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4581 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4582 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4583 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4584 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4585 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4586 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4587 | .input_mux = &alc880_capture_source, |
| 4588 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4589 | [ALC880_UNIWILL] = { |
| 4590 | .mixers = { alc880_uniwill_mixer }, |
| 4591 | .init_verbs = { alc880_volume_init_verbs, |
| 4592 | alc880_uniwill_init_verbs }, |
| 4593 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4594 | .dac_nids = alc880_asus_dac_nids, |
| 4595 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4596 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4597 | .channel_mode = alc880_threestack_modes, |
| 4598 | .need_dac_fix = 1, |
| 4599 | .input_mux = &alc880_capture_source, |
| 4600 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4601 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4602 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4603 | }, |
| 4604 | [ALC880_UNIWILL_P53] = { |
| 4605 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4606 | .init_verbs = { alc880_volume_init_verbs, |
| 4607 | alc880_uniwill_p53_init_verbs }, |
| 4608 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4609 | .dac_nids = alc880_asus_dac_nids, |
| 4610 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4611 | .channel_mode = alc880_threestack_modes, |
| 4612 | .input_mux = &alc880_capture_source, |
| 4613 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4614 | .setup = alc880_uniwill_p53_setup, |
| 4615 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4616 | }, |
| 4617 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4618 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4619 | .init_verbs = { alc880_volume_init_verbs, |
| 4620 | alc880_uniwill_p53_init_verbs, |
| 4621 | alc880_beep_init_verbs }, |
| 4622 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4623 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4624 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4625 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4626 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4627 | .input_mux = &alc880_capture_source, |
| 4628 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4629 | .setup = alc880_uniwill_p53_setup, |
| 4630 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4631 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4632 | [ALC880_CLEVO] = { |
| 4633 | .mixers = { alc880_three_stack_mixer }, |
| 4634 | .init_verbs = { alc880_volume_init_verbs, |
| 4635 | alc880_pin_clevo_init_verbs }, |
| 4636 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4637 | .dac_nids = alc880_dac_nids, |
| 4638 | .hp_nid = 0x03, |
| 4639 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4640 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4641 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4642 | .input_mux = &alc880_capture_source, |
| 4643 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4644 | [ALC880_LG] = { |
| 4645 | .mixers = { alc880_lg_mixer }, |
| 4646 | .init_verbs = { alc880_volume_init_verbs, |
| 4647 | alc880_lg_init_verbs }, |
| 4648 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4649 | .dac_nids = alc880_lg_dac_nids, |
| 4650 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4651 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4652 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4653 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4654 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4655 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4656 | .setup = alc880_lg_setup, |
| 4657 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4658 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4659 | .loopbacks = alc880_lg_loopbacks, |
| 4660 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4661 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4662 | [ALC880_LG_LW] = { |
| 4663 | .mixers = { alc880_lg_lw_mixer }, |
| 4664 | .init_verbs = { alc880_volume_init_verbs, |
| 4665 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4666 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4667 | .dac_nids = alc880_dac_nids, |
| 4668 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4669 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4670 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4671 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4672 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4673 | .setup = alc880_lg_lw_setup, |
| 4674 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4675 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4676 | [ALC880_MEDION_RIM] = { |
| 4677 | .mixers = { alc880_medion_rim_mixer }, |
| 4678 | .init_verbs = { alc880_volume_init_verbs, |
| 4679 | alc880_medion_rim_init_verbs, |
| 4680 | alc_gpio2_init_verbs }, |
| 4681 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4682 | .dac_nids = alc880_dac_nids, |
| 4683 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4684 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4685 | .channel_mode = alc880_2_jack_modes, |
| 4686 | .input_mux = &alc880_medion_rim_capture_source, |
| 4687 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4688 | .setup = alc880_medion_rim_setup, |
| 4689 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4690 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4691 | #ifdef CONFIG_SND_DEBUG |
| 4692 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4693 | .mixers = { alc880_test_mixer }, |
| 4694 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4695 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4696 | .dac_nids = alc880_test_dac_nids, |
| 4697 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4698 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4699 | .channel_mode = alc880_test_modes, |
| 4700 | .input_mux = &alc880_test_capture_source, |
| 4701 | }, |
| 4702 | #endif |
| 4703 | }; |
| 4704 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4705 | /* |
| 4706 | * Automatic parse of I/O pins from the BIOS configuration |
| 4707 | */ |
| 4708 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4709 | enum { |
| 4710 | ALC_CTL_WIDGET_VOL, |
| 4711 | ALC_CTL_WIDGET_MUTE, |
| 4712 | ALC_CTL_BIND_MUTE, |
| 4713 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4714 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4715 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4716 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4717 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4718 | }; |
| 4719 | |
| 4720 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4721 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4722 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4723 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4724 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4725 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4726 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4727 | knew = snd_array_new(&spec->kctls); |
| 4728 | if (!knew) |
| 4729 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4730 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4731 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4732 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4733 | return -ENOMEM; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 4734 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 4735 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4736 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4737 | return 0; |
| 4738 | } |
| 4739 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4740 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 4741 | const char *pfx, const char *dir, |
| 4742 | const char *sfx, unsigned long val) |
| 4743 | { |
| 4744 | char name[32]; |
| 4745 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
| 4746 | return add_control(spec, type, name, val); |
| 4747 | } |
| 4748 | |
| 4749 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 4750 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val) |
| 4751 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 4752 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val) |
| 4753 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4754 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4755 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4756 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4757 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4758 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4759 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4760 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4761 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4762 | #define ALC880_PIN_CD_NID 0x1c |
| 4763 | |
| 4764 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4765 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4766 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4767 | { |
| 4768 | hda_nid_t nid; |
| 4769 | int assigned[4]; |
| 4770 | int i, j; |
| 4771 | |
| 4772 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4773 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4774 | |
| 4775 | /* check the pins hardwired to audio widget */ |
| 4776 | for (i = 0; i < cfg->line_outs; i++) { |
| 4777 | nid = cfg->line_out_pins[i]; |
| 4778 | if (alc880_is_fixed_pin(nid)) { |
| 4779 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4780 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4781 | assigned[idx] = 1; |
| 4782 | } |
| 4783 | } |
| 4784 | /* left pins can be connect to any audio widget */ |
| 4785 | for (i = 0; i < cfg->line_outs; i++) { |
| 4786 | nid = cfg->line_out_pins[i]; |
| 4787 | if (alc880_is_fixed_pin(nid)) |
| 4788 | continue; |
| 4789 | /* search for an empty channel */ |
| 4790 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4791 | if (!assigned[j]) { |
| 4792 | spec->multiout.dac_nids[i] = |
| 4793 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4794 | assigned[j] = 1; |
| 4795 | break; |
| 4796 | } |
| 4797 | } |
| 4798 | } |
| 4799 | spec->multiout.num_dacs = cfg->line_outs; |
| 4800 | return 0; |
| 4801 | } |
| 4802 | |
| 4803 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4804 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4805 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4806 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4807 | static const char *chname[4] = { |
| 4808 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4809 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4810 | hda_nid_t nid; |
| 4811 | int i, err; |
| 4812 | |
| 4813 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4814 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4815 | continue; |
| 4816 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4817 | if (i == 2) { |
| 4818 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4819 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4820 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4821 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4822 | HDA_OUTPUT)); |
| 4823 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4824 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4825 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4826 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4827 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4828 | HDA_OUTPUT)); |
| 4829 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4830 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4831 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4832 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4833 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4834 | HDA_INPUT)); |
| 4835 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4836 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4837 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4838 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4839 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4840 | HDA_INPUT)); |
| 4841 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4842 | return err; |
| 4843 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4844 | const char *pfx; |
| 4845 | if (cfg->line_outs == 1 && |
| 4846 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 4847 | pfx = "Speaker"; |
| 4848 | else |
| 4849 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4850 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4851 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4852 | HDA_OUTPUT)); |
| 4853 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4854 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4855 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4856 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4857 | HDA_INPUT)); |
| 4858 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4859 | return err; |
| 4860 | } |
| 4861 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4862 | return 0; |
| 4863 | } |
| 4864 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4865 | /* add playback controls for speaker and HP outputs */ |
| 4866 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4867 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4868 | { |
| 4869 | hda_nid_t nid; |
| 4870 | int err; |
| 4871 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4872 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4873 | return 0; |
| 4874 | |
| 4875 | if (alc880_is_fixed_pin(pin)) { |
| 4876 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4877 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4878 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4879 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4880 | else |
| 4881 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4882 | /* control HP volume/switch on the output mixer amp */ |
| 4883 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4884 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4885 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4886 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4887 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4888 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4889 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4890 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4891 | return err; |
| 4892 | } else if (alc880_is_multi_pin(pin)) { |
| 4893 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4894 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4895 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4896 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4897 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4898 | return err; |
| 4899 | } |
| 4900 | return 0; |
| 4901 | } |
| 4902 | |
| 4903 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4904 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4905 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4906 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4907 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4908 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4909 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4910 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4911 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4912 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4913 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4914 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4915 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4916 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4917 | return err; |
| 4918 | return 0; |
| 4919 | } |
| 4920 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4921 | 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] | 4922 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4923 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 4924 | return (pincap & AC_PINCAP_IN) != 0; |
| 4925 | } |
| 4926 | |
| 4927 | /* create playback/capture controls for input pins */ |
| 4928 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 4929 | const struct auto_pin_cfg *cfg, |
| 4930 | hda_nid_t mixer, |
| 4931 | hda_nid_t cap1, hda_nid_t cap2) |
| 4932 | { |
| 4933 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4934 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4935 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4936 | |
| 4937 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4938 | hda_nid_t pin; |
| 4939 | |
| 4940 | pin = cfg->input_pins[i]; |
| 4941 | if (!alc_is_input_pin(codec, pin)) |
| 4942 | continue; |
| 4943 | |
| 4944 | if (mixer) { |
| 4945 | idx = get_connection_index(codec, mixer, pin); |
| 4946 | if (idx >= 0) { |
| 4947 | err = new_analog_input(spec, pin, |
| 4948 | auto_pin_cfg_labels[i], |
| 4949 | idx, mixer); |
| 4950 | if (err < 0) |
| 4951 | return err; |
| 4952 | } |
| 4953 | } |
| 4954 | |
| 4955 | if (!cap1) |
| 4956 | continue; |
| 4957 | idx = get_connection_index(codec, cap1, pin); |
| 4958 | if (idx < 0 && cap2) |
| 4959 | idx = get_connection_index(codec, cap2, pin); |
| 4960 | if (idx >= 0) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4961 | imux->items[imux->num_items].label = |
| 4962 | auto_pin_cfg_labels[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4963 | imux->items[imux->num_items].index = idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4964 | imux->num_items++; |
| 4965 | } |
| 4966 | } |
| 4967 | return 0; |
| 4968 | } |
| 4969 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4970 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 4971 | const struct auto_pin_cfg *cfg) |
| 4972 | { |
| 4973 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 4974 | } |
| 4975 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4976 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4977 | unsigned int pin_type) |
| 4978 | { |
| 4979 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4980 | pin_type); |
| 4981 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4982 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4983 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4984 | } |
| 4985 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4986 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4987 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4988 | int dac_idx) |
| 4989 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4990 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4991 | /* need the manual connection? */ |
| 4992 | if (alc880_is_multi_pin(nid)) { |
| 4993 | struct alc_spec *spec = codec->spec; |
| 4994 | int idx = alc880_multi_pin_idx(nid); |
| 4995 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4996 | AC_VERB_SET_CONNECT_SEL, |
| 4997 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4998 | } |
| 4999 | } |
| 5000 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5001 | static int get_pin_type(int line_out_type) |
| 5002 | { |
| 5003 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5004 | return PIN_HP; |
| 5005 | else |
| 5006 | return PIN_OUT; |
| 5007 | } |
| 5008 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5009 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 5010 | { |
| 5011 | struct alc_spec *spec = codec->spec; |
| 5012 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5013 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5014 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 5015 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5016 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5017 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5018 | } |
| 5019 | } |
| 5020 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5021 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5022 | { |
| 5023 | struct alc_spec *spec = codec->spec; |
| 5024 | hda_nid_t pin; |
| 5025 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5026 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5027 | if (pin) /* connect to front */ |
| 5028 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5029 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5030 | if (pin) /* connect to front */ |
| 5031 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5032 | } |
| 5033 | |
| 5034 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 5035 | { |
| 5036 | struct alc_spec *spec = codec->spec; |
| 5037 | int i; |
| 5038 | |
| 5039 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5040 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5041 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 5042 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5043 | if (nid != ALC880_PIN_CD_NID && |
| 5044 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5045 | snd_hda_codec_write(codec, nid, 0, |
| 5046 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5047 | AMP_OUT_MUTE); |
| 5048 | } |
| 5049 | } |
| 5050 | } |
| 5051 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5052 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5053 | { |
| 5054 | struct alc_spec *spec = codec->spec; |
| 5055 | int c; |
| 5056 | |
| 5057 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5058 | unsigned int mux_idx; |
| 5059 | const struct hda_input_mux *imux; |
| 5060 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5061 | imux = &spec->input_mux[mux_idx]; |
| 5062 | if (!imux->num_items && mux_idx > 0) |
| 5063 | imux = &spec->input_mux[0]; |
| 5064 | if (imux) |
| 5065 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5066 | AC_VERB_SET_CONNECT_SEL, |
| 5067 | imux->items[0].index); |
| 5068 | } |
| 5069 | } |
| 5070 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5071 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5072 | /* return 1 if successful, 0 if the proper config is not found, |
| 5073 | * or a negative error code |
| 5074 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5075 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5076 | { |
| 5077 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5078 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5079 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5080 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5081 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5082 | alc880_ignore); |
| 5083 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5084 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5085 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5086 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5087 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5088 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5089 | if (err < 0) |
| 5090 | return err; |
| 5091 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5092 | if (err < 0) |
| 5093 | return err; |
| 5094 | err = alc880_auto_create_extra_out(spec, |
| 5095 | spec->autocfg.speaker_pins[0], |
| 5096 | "Speaker"); |
| 5097 | if (err < 0) |
| 5098 | return err; |
| 5099 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5100 | "Headphone"); |
| 5101 | if (err < 0) |
| 5102 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5103 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5104 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5105 | return err; |
| 5106 | |
| 5107 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5108 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5109 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5110 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5111 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5112 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5113 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5114 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5115 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5116 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5117 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5118 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5119 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5120 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5121 | return 1; |
| 5122 | } |
| 5123 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5124 | /* additional initialization for auto-configuration model */ |
| 5125 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5126 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5127 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5128 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5129 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5130 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5131 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5132 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5133 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5134 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5135 | } |
| 5136 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5137 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5138 | * one of two digital mic pins, e.g. on ALC272 |
| 5139 | */ |
| 5140 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5141 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5142 | struct alc_spec *spec = codec->spec; |
| 5143 | int i; |
| 5144 | |
| 5145 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5146 | hda_nid_t cap = spec->capsrc_nids ? |
| 5147 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5148 | int iidx, eidx; |
| 5149 | |
| 5150 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5151 | if (iidx < 0) |
| 5152 | continue; |
| 5153 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5154 | if (eidx < 0) |
| 5155 | continue; |
| 5156 | spec->int_mic.mux_idx = iidx; |
| 5157 | spec->ext_mic.mux_idx = eidx; |
| 5158 | if (spec->capsrc_nids) |
| 5159 | spec->capsrc_nids += i; |
| 5160 | spec->adc_nids += i; |
| 5161 | spec->num_adc_nids = 1; |
| 5162 | return; |
| 5163 | } |
| 5164 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5165 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5166 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5167 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5168 | } |
| 5169 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5170 | /* select or unmute the given capsrc route */ |
| 5171 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5172 | int idx) |
| 5173 | { |
| 5174 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5175 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5176 | HDA_AMP_MUTE, 0); |
| 5177 | } else { |
| 5178 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5179 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5180 | } |
| 5181 | } |
| 5182 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5183 | /* set the default connection to that pin */ |
| 5184 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5185 | { |
| 5186 | struct alc_spec *spec = codec->spec; |
| 5187 | int i; |
| 5188 | |
| 5189 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5190 | hda_nid_t cap = spec->capsrc_nids ? |
| 5191 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5192 | int idx; |
| 5193 | |
| 5194 | idx = get_connection_index(codec, cap, pin); |
| 5195 | if (idx < 0) |
| 5196 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5197 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5198 | return i; /* return the found index */ |
| 5199 | } |
| 5200 | return -1; /* not found */ |
| 5201 | } |
| 5202 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5203 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5204 | static void fixup_single_adc(struct hda_codec *codec) |
| 5205 | { |
| 5206 | struct alc_spec *spec = codec->spec; |
Frederik Deweerdt | d2db09b | 2010-03-05 16:34:31 +0100 | [diff] [blame] | 5207 | hda_nid_t pin = 0; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5208 | int i; |
| 5209 | |
| 5210 | /* search for the input pin; there must be only one */ |
| 5211 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5212 | if (spec->autocfg.input_pins[i]) { |
| 5213 | pin = spec->autocfg.input_pins[i]; |
| 5214 | break; |
| 5215 | } |
| 5216 | } |
| 5217 | if (!pin) |
| 5218 | return; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5219 | i = init_capsrc_for_pin(codec, pin); |
| 5220 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5221 | /* use only this ADC */ |
| 5222 | if (spec->capsrc_nids) |
| 5223 | spec->capsrc_nids += i; |
| 5224 | spec->adc_nids += i; |
| 5225 | spec->num_adc_nids = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5226 | } |
| 5227 | } |
| 5228 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5229 | /* initialize dual adcs */ |
| 5230 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5231 | { |
| 5232 | struct alc_spec *spec = codec->spec; |
| 5233 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
| 5234 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5235 | } |
| 5236 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5237 | static void set_capture_mixer(struct hda_codec *codec) |
| 5238 | { |
| 5239 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5240 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5241 | { alc_capture_mixer_nosrc1, |
| 5242 | alc_capture_mixer_nosrc2, |
| 5243 | alc_capture_mixer_nosrc3 }, |
| 5244 | { alc_capture_mixer1, |
| 5245 | alc_capture_mixer2, |
| 5246 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5247 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5248 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5249 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5250 | int num_adcs = spec->num_adc_nids; |
| 5251 | if (spec->dual_adc_switch) |
| 5252 | fixup_dual_adc_switch(codec); |
| 5253 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5254 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5255 | else if (spec->input_mux) { |
| 5256 | if (spec->input_mux->num_items > 1) |
| 5257 | mux = 1; |
| 5258 | else if (spec->input_mux->num_items == 1) |
| 5259 | fixup_single_adc(codec); |
| 5260 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5261 | if (spec->dual_adc_switch) |
| 5262 | num_adcs = 1; |
| 5263 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5264 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5265 | } |
| 5266 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5267 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5268 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5269 | int num_nids) |
| 5270 | { |
| 5271 | struct alc_spec *spec = codec->spec; |
| 5272 | int n; |
| 5273 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5274 | |
| 5275 | for (n = 0; n < num_nids; n++) { |
| 5276 | hda_nid_t adc, cap; |
| 5277 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5278 | int nconns, i, j; |
| 5279 | |
| 5280 | adc = nids[n]; |
| 5281 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5282 | continue; |
| 5283 | cap = adc; |
| 5284 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5285 | ARRAY_SIZE(conn)); |
| 5286 | if (nconns == 1) { |
| 5287 | cap = conn[0]; |
| 5288 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5289 | ARRAY_SIZE(conn)); |
| 5290 | } |
| 5291 | if (nconns <= 0) |
| 5292 | continue; |
| 5293 | if (!fallback_adc) { |
| 5294 | fallback_adc = adc; |
| 5295 | fallback_cap = cap; |
| 5296 | } |
| 5297 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5298 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5299 | if (!nid) |
| 5300 | continue; |
| 5301 | for (j = 0; j < nconns; j++) { |
| 5302 | if (conn[j] == nid) |
| 5303 | break; |
| 5304 | } |
| 5305 | if (j >= nconns) |
| 5306 | break; |
| 5307 | } |
| 5308 | if (i >= AUTO_PIN_LAST) { |
| 5309 | int num_adcs = spec->num_adc_nids; |
| 5310 | spec->private_adc_nids[num_adcs] = adc; |
| 5311 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5312 | spec->num_adc_nids++; |
| 5313 | spec->adc_nids = spec->private_adc_nids; |
| 5314 | if (adc != cap) |
| 5315 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5316 | } |
| 5317 | } |
| 5318 | if (!spec->num_adc_nids) { |
| 5319 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5320 | " using fallback 0x%x\n", |
| 5321 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5322 | spec->private_adc_nids[0] = fallback_adc; |
| 5323 | spec->adc_nids = spec->private_adc_nids; |
| 5324 | if (fallback_adc != fallback_cap) { |
| 5325 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5326 | spec->capsrc_nids = spec->private_adc_nids; |
| 5327 | } |
| 5328 | } |
| 5329 | } |
| 5330 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5331 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5332 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5333 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5334 | |
| 5335 | static struct snd_pci_quirk beep_white_list[] = { |
| 5336 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5337 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5338 | {} |
| 5339 | }; |
| 5340 | |
| 5341 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5342 | { |
| 5343 | struct alc_spec *spec = codec->spec; |
| 5344 | const struct snd_pci_quirk *q; |
| 5345 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5346 | if (q) |
| 5347 | return q->value; |
| 5348 | return spec->cdefine.enable_pcbeep; |
| 5349 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5350 | #else |
| 5351 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5352 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5353 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5354 | |
| 5355 | /* |
| 5356 | * OK, here we have finally the patch for ALC880 |
| 5357 | */ |
| 5358 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5359 | static int patch_alc880(struct hda_codec *codec) |
| 5360 | { |
| 5361 | struct alc_spec *spec; |
| 5362 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5363 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5364 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5365 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5366 | if (spec == NULL) |
| 5367 | return -ENOMEM; |
| 5368 | |
| 5369 | codec->spec = spec; |
| 5370 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5371 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5372 | alc880_models, |
| 5373 | alc880_cfg_tbl); |
| 5374 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5375 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5376 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5377 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5378 | } |
| 5379 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5380 | if (board_config == ALC880_AUTO) { |
| 5381 | /* automatic parse from the BIOS config */ |
| 5382 | err = alc880_parse_auto_config(codec); |
| 5383 | if (err < 0) { |
| 5384 | alc_free(codec); |
| 5385 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5386 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5387 | printk(KERN_INFO |
| 5388 | "hda_codec: Cannot set up configuration " |
| 5389 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5390 | board_config = ALC880_3ST; |
| 5391 | } |
| 5392 | } |
| 5393 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5394 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5395 | if (err < 0) { |
| 5396 | alc_free(codec); |
| 5397 | return err; |
| 5398 | } |
| 5399 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5400 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5401 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5402 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5403 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5404 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5405 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5406 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5407 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5408 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5409 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5410 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5411 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5412 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5413 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5414 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5415 | if (wcap != AC_WID_AUD_IN) { |
| 5416 | spec->adc_nids = alc880_adc_nids_alt; |
| 5417 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5418 | } else { |
| 5419 | spec->adc_nids = alc880_adc_nids; |
| 5420 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5421 | } |
| 5422 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5423 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5424 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5425 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5426 | spec->vmaster_nid = 0x0c; |
| 5427 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5428 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5429 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5430 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5431 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5432 | if (!spec->loopback.amplist) |
| 5433 | spec->loopback.amplist = alc880_loopbacks; |
| 5434 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5435 | |
| 5436 | return 0; |
| 5437 | } |
| 5438 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5439 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5440 | /* |
| 5441 | * ALC260 support |
| 5442 | */ |
| 5443 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5444 | static hda_nid_t alc260_dac_nids[1] = { |
| 5445 | /* front */ |
| 5446 | 0x02, |
| 5447 | }; |
| 5448 | |
| 5449 | static hda_nid_t alc260_adc_nids[1] = { |
| 5450 | /* ADC0 */ |
| 5451 | 0x04, |
| 5452 | }; |
| 5453 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5454 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5455 | /* ADC1 */ |
| 5456 | 0x05, |
| 5457 | }; |
| 5458 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5459 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5460 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5461 | */ |
| 5462 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5463 | /* ADC0, ADC1 */ |
| 5464 | 0x04, 0x05 |
| 5465 | }; |
| 5466 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5467 | #define ALC260_DIGOUT_NID 0x03 |
| 5468 | #define ALC260_DIGIN_NID 0x06 |
| 5469 | |
| 5470 | static struct hda_input_mux alc260_capture_source = { |
| 5471 | .num_items = 4, |
| 5472 | .items = { |
| 5473 | { "Mic", 0x0 }, |
| 5474 | { "Front Mic", 0x1 }, |
| 5475 | { "Line", 0x2 }, |
| 5476 | { "CD", 0x4 }, |
| 5477 | }, |
| 5478 | }; |
| 5479 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5480 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5481 | * headphone jack and the internal CD lines since these are the only pins at |
| 5482 | * which audio can appear. For flexibility, also allow the option of |
| 5483 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5484 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5485 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5486 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5487 | { |
| 5488 | .num_items = 3, |
| 5489 | .items = { |
| 5490 | { "Mic/Line", 0x0 }, |
| 5491 | { "CD", 0x4 }, |
| 5492 | { "Headphone", 0x2 }, |
| 5493 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5494 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5495 | { |
| 5496 | .num_items = 4, |
| 5497 | .items = { |
| 5498 | { "Mic/Line", 0x0 }, |
| 5499 | { "CD", 0x4 }, |
| 5500 | { "Headphone", 0x2 }, |
| 5501 | { "Mixer", 0x5 }, |
| 5502 | }, |
| 5503 | }, |
| 5504 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5505 | }; |
| 5506 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5507 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5508 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5509 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5510 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5511 | { |
| 5512 | .num_items = 4, |
| 5513 | .items = { |
| 5514 | { "Mic", 0x0 }, |
| 5515 | { "Line", 0x2 }, |
| 5516 | { "CD", 0x4 }, |
| 5517 | { "Headphone", 0x5 }, |
| 5518 | }, |
| 5519 | }, |
| 5520 | { |
| 5521 | .num_items = 5, |
| 5522 | .items = { |
| 5523 | { "Mic", 0x0 }, |
| 5524 | { "Line", 0x2 }, |
| 5525 | { "CD", 0x4 }, |
| 5526 | { "Headphone", 0x6 }, |
| 5527 | { "Mixer", 0x5 }, |
| 5528 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5529 | }, |
| 5530 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5531 | |
| 5532 | /* Maxdata Favorit 100XS */ |
| 5533 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5534 | { |
| 5535 | .num_items = 2, |
| 5536 | .items = { |
| 5537 | { "Line/Mic", 0x0 }, |
| 5538 | { "CD", 0x4 }, |
| 5539 | }, |
| 5540 | }, |
| 5541 | { |
| 5542 | .num_items = 3, |
| 5543 | .items = { |
| 5544 | { "Line/Mic", 0x0 }, |
| 5545 | { "CD", 0x4 }, |
| 5546 | { "Mixer", 0x5 }, |
| 5547 | }, |
| 5548 | }, |
| 5549 | }; |
| 5550 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5551 | /* |
| 5552 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5553 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5554 | * element which allows changing the channel mode, so the verb list is |
| 5555 | * never used. |
| 5556 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5557 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5558 | { 2, NULL }, |
| 5559 | }; |
| 5560 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5561 | |
| 5562 | /* Mixer combinations |
| 5563 | * |
| 5564 | * basic: base_output + input + pc_beep + capture |
| 5565 | * HP: base_output + input + capture_alt |
| 5566 | * HP_3013: hp_3013 + input + capture |
| 5567 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5568 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5569 | */ |
| 5570 | |
| 5571 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5572 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5573 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5574 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5575 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5576 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5577 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5578 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5579 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5580 | |
| 5581 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5582 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5583 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5584 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5585 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5586 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5587 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5588 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5589 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5590 | { } /* end */ |
| 5591 | }; |
| 5592 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5593 | /* update HP, line and mono out pins according to the master switch */ |
| 5594 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5595 | hda_nid_t hp, hda_nid_t line, |
| 5596 | hda_nid_t mono) |
| 5597 | { |
| 5598 | struct alc_spec *spec = codec->spec; |
| 5599 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5600 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5601 | 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] | 5602 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5603 | 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] | 5604 | val); |
| 5605 | /* mono (speaker) depending on the HP jack sense */ |
| 5606 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5607 | 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] | 5608 | val); |
| 5609 | } |
| 5610 | |
| 5611 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5612 | struct snd_ctl_elem_value *ucontrol) |
| 5613 | { |
| 5614 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5615 | struct alc_spec *spec = codec->spec; |
| 5616 | *ucontrol->value.integer.value = spec->master_sw; |
| 5617 | return 0; |
| 5618 | } |
| 5619 | |
| 5620 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5621 | struct snd_ctl_elem_value *ucontrol) |
| 5622 | { |
| 5623 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5624 | struct alc_spec *spec = codec->spec; |
| 5625 | int val = !!*ucontrol->value.integer.value; |
| 5626 | hda_nid_t hp, line, mono; |
| 5627 | |
| 5628 | if (val == spec->master_sw) |
| 5629 | return 0; |
| 5630 | spec->master_sw = val; |
| 5631 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5632 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5633 | mono = kcontrol->private_value & 0xff; |
| 5634 | alc260_hp_master_update(codec, hp, line, mono); |
| 5635 | return 1; |
| 5636 | } |
| 5637 | |
| 5638 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5639 | { |
| 5640 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5641 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5642 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5643 | .info = snd_ctl_boolean_mono_info, |
| 5644 | .get = alc260_hp_master_sw_get, |
| 5645 | .put = alc260_hp_master_sw_put, |
| 5646 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5647 | }, |
| 5648 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5649 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5650 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5651 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5652 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5653 | HDA_OUTPUT), |
| 5654 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5655 | { } /* end */ |
| 5656 | }; |
| 5657 | |
| 5658 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5659 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5660 | {}, |
| 5661 | }; |
| 5662 | |
| 5663 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5664 | { |
| 5665 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5666 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5667 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5668 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5669 | } |
| 5670 | |
| 5671 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5672 | { |
| 5673 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5674 | alc260_hp_automute(codec); |
| 5675 | } |
| 5676 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5677 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5678 | { |
| 5679 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5680 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5681 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5682 | .info = snd_ctl_boolean_mono_info, |
| 5683 | .get = alc260_hp_master_sw_get, |
| 5684 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5685 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5686 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5687 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5688 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5689 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5690 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5691 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5692 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5693 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5694 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5695 | { } /* end */ |
| 5696 | }; |
| 5697 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5698 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5699 | .ops = &snd_hda_bind_vol, |
| 5700 | .values = { |
| 5701 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5702 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5703 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5704 | 0 |
| 5705 | }, |
| 5706 | }; |
| 5707 | |
| 5708 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5709 | .ops = &snd_hda_bind_sw, |
| 5710 | .values = { |
| 5711 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5712 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5713 | 0 |
| 5714 | }, |
| 5715 | }; |
| 5716 | |
| 5717 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5718 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5719 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5720 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5721 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5722 | { } /* end */ |
| 5723 | }; |
| 5724 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5725 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5726 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5727 | {}, |
| 5728 | }; |
| 5729 | |
| 5730 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5731 | { |
| 5732 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5733 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5734 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5735 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5736 | } |
| 5737 | |
| 5738 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5739 | unsigned int res) |
| 5740 | { |
| 5741 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5742 | alc260_hp_3013_automute(codec); |
| 5743 | } |
| 5744 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5745 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5746 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5747 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5748 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5749 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5750 | bits); |
| 5751 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5752 | bits); |
| 5753 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5754 | bits); |
| 5755 | } |
| 5756 | |
| 5757 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5758 | unsigned int res) |
| 5759 | { |
| 5760 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5761 | alc260_hp_3012_automute(codec); |
| 5762 | } |
| 5763 | |
| 5764 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5765 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5766 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5767 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5768 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5769 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5770 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5771 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5772 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5773 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5774 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5775 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5776 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5777 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5778 | { } /* end */ |
| 5779 | }; |
| 5780 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5781 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5782 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5783 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5784 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5785 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5786 | * revisions available in early 2006. Therefore for now allow the |
| 5787 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5788 | * that the lack of mic bias for this NID is intentional we could change the |
| 5789 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5790 | * |
| 5791 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5792 | * don't appear to make the mic bias available from the "line" jack, even |
| 5793 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5794 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5795 | * and the output jack. If this turns out to be the case for all such |
| 5796 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5797 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5798 | * |
| 5799 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5800 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5801 | * controls for such models. On models without a "mono speaker" the control |
| 5802 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5803 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5804 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5805 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5806 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5807 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5808 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5809 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5810 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5811 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5812 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5813 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5814 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5815 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5816 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5817 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5818 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5819 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5820 | { } /* end */ |
| 5821 | }; |
| 5822 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5823 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5824 | */ |
| 5825 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5826 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5827 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5828 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5829 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5830 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5831 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5832 | { } /* end */ |
| 5833 | }; |
| 5834 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5835 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5836 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5837 | */ |
| 5838 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5839 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5840 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5841 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5842 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5843 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5844 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5845 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5846 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5847 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5848 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5849 | { } /* end */ |
| 5850 | }; |
| 5851 | |
| 5852 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5853 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5854 | */ |
| 5855 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5856 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5857 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5858 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5859 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5860 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5861 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5862 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5863 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5864 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5865 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5866 | { } /* end */ |
| 5867 | }; |
| 5868 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5869 | /* |
| 5870 | * initialization verbs |
| 5871 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5872 | static struct hda_verb alc260_init_verbs[] = { |
| 5873 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5874 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5875 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5876 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5877 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5878 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5879 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5880 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5881 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5882 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5883 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5884 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5885 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5886 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5887 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5888 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5889 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5890 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5891 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5892 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5893 | /* set connection select to line in (default select for this ADC) */ |
| 5894 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5895 | /* mute capture amp left and right */ |
| 5896 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5897 | /* set connection select to line in (default select for this ADC) */ |
| 5898 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5899 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5900 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5901 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5902 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5903 | /* set vol=0 HP mixer amp left and right */ |
| 5904 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5905 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5906 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5907 | /* set vol=0 Mono mixer amp left and right */ |
| 5908 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5909 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5910 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5911 | /* unmute LINE-2 out pin */ |
| 5912 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5913 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5914 | * Line In 2 = 0x03 |
| 5915 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5916 | /* mute analog inputs */ |
| 5917 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5918 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5919 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5920 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5921 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5922 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5923 | /* mute Front out path */ |
| 5924 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5925 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5926 | /* mute Headphone out path */ |
| 5927 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5928 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5929 | /* mute Mono out path */ |
| 5930 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5931 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5932 | { } |
| 5933 | }; |
| 5934 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5935 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5936 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5937 | /* Headphone and output */ |
| 5938 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5939 | /* mono output */ |
| 5940 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5941 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5942 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5943 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5944 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5945 | /* Line In pin widget for input */ |
| 5946 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5947 | /* Line-2 pin widget for output */ |
| 5948 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5949 | /* CD pin widget for input */ |
| 5950 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5951 | /* unmute amp left and right */ |
| 5952 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5953 | /* set connection select to line in (default select for this ADC) */ |
| 5954 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5955 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5956 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5957 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5958 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5959 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5960 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5961 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5962 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5963 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5964 | * Line In 2 = 0x03 |
| 5965 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5966 | /* mute analog inputs */ |
| 5967 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5968 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5969 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5970 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5971 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5972 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5973 | /* Unmute Front out path */ |
| 5974 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5975 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5976 | /* Unmute Headphone out path */ |
| 5977 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5978 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5979 | /* Unmute Mono out path */ |
| 5980 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5981 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5982 | { } |
| 5983 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5984 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5985 | |
| 5986 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5987 | /* Line out and output */ |
| 5988 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5989 | /* mono output */ |
| 5990 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5991 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5992 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5993 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5994 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5995 | /* Line In pin widget for input */ |
| 5996 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5997 | /* Headphone pin widget for output */ |
| 5998 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5999 | /* CD pin widget for input */ |
| 6000 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6001 | /* unmute amp left and right */ |
| 6002 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6003 | /* set connection select to line in (default select for this ADC) */ |
| 6004 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6005 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6006 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6007 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6008 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6009 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6010 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6011 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6012 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6013 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6014 | * Line In 2 = 0x03 |
| 6015 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6016 | /* mute analog inputs */ |
| 6017 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6018 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6019 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6020 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6021 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6022 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6023 | /* Unmute Front out path */ |
| 6024 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6025 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6026 | /* Unmute Headphone out path */ |
| 6027 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6028 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6029 | /* Unmute Mono out path */ |
| 6030 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6031 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6032 | { } |
| 6033 | }; |
| 6034 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6035 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6036 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6037 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6038 | */ |
| 6039 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 6040 | /* Disable all GPIOs */ |
| 6041 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6042 | /* Internal speaker is connected to headphone pin */ |
| 6043 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6044 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6045 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6046 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6047 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6048 | /* Ensure all other unused pins are disabled and muted. */ |
| 6049 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6050 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6051 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6052 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6053 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6054 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6055 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6056 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6057 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6058 | /* Disable digital (SPDIF) pins */ |
| 6059 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6060 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6061 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6062 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6063 | * when acting as an output. |
| 6064 | */ |
| 6065 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6066 | |
| 6067 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6068 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6069 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6070 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6071 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6072 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6073 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6074 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6075 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6076 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6077 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6078 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6079 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6080 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6081 | * If the pin mode is changed by the user the pin mode control will |
| 6082 | * take care of enabling the pin's input/output buffers as needed. |
| 6083 | * Therefore there's no need to enable the input buffer at this |
| 6084 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6085 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6086 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6087 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6088 | * mixer ctrl) |
| 6089 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6090 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6091 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6092 | /* Mute capture amp left and right */ |
| 6093 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6094 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6095 | * in (on mic1 pin) |
| 6096 | */ |
| 6097 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6098 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6099 | /* Do the same for the second ADC: mute capture input amp and |
| 6100 | * set ADC connection to line in (on mic1 pin) |
| 6101 | */ |
| 6102 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6103 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6104 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6105 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6106 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6107 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6108 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6109 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6110 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6111 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6112 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6113 | {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] | 6114 | |
| 6115 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6116 | }; |
| 6117 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6118 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6119 | * similar laptops (adapted from Fujitsu init verbs). |
| 6120 | */ |
| 6121 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 6122 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6123 | * the headphone jack. Turn this on and rely on the standard mute |
| 6124 | * methods whenever the user wants to turn these outputs off. |
| 6125 | */ |
| 6126 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6127 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6128 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6129 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6130 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6131 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6132 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6133 | /* Line In jack is connected to Line1 pin */ |
| 6134 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6135 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6136 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6137 | /* Ensure all other unused pins are disabled and muted. */ |
| 6138 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6139 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6140 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6141 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6142 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6143 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6144 | /* Disable digital (SPDIF) pins */ |
| 6145 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6146 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6147 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6148 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6149 | * bus when acting as outputs. |
| 6150 | */ |
| 6151 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6152 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6153 | |
| 6154 | /* Start with output sum widgets muted and their output gains at min */ |
| 6155 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6156 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6157 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6158 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6159 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6160 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6161 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6162 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6163 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6164 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6165 | /* Unmute Line-out pin widget amp left and right |
| 6166 | * (no equiv mixer ctrl) |
| 6167 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6168 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6169 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6170 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6171 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6172 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6173 | * will take care of enabling the pin's input/output buffers as needed. |
| 6174 | * Therefore there's no need to enable the input buffer at this |
| 6175 | * stage. |
| 6176 | */ |
| 6177 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6178 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6179 | |
| 6180 | /* Mute capture amp left and right */ |
| 6181 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6182 | /* Set ADC connection select to match default mixer setting - mic |
| 6183 | * (on mic1 pin) |
| 6184 | */ |
| 6185 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6186 | |
| 6187 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6188 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6189 | */ |
| 6190 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6191 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6192 | |
| 6193 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6194 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6195 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6196 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6197 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6198 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6199 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6200 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6201 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6202 | |
| 6203 | { } |
| 6204 | }; |
| 6205 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6206 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6207 | * (adapted from Acer init verbs). |
| 6208 | */ |
| 6209 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6210 | /* GPIO 0 enables the output jack. |
| 6211 | * Turn this on and rely on the standard mute |
| 6212 | * methods whenever the user wants to turn these outputs off. |
| 6213 | */ |
| 6214 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6215 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6216 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6217 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6218 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6219 | /* Ensure all other unused pins are disabled and muted. */ |
| 6220 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6221 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6222 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6223 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6224 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6225 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6226 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6227 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6228 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6229 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6230 | /* Disable digital (SPDIF) pins */ |
| 6231 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6232 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6233 | |
| 6234 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6235 | * bus when acting as outputs. |
| 6236 | */ |
| 6237 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6238 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6239 | |
| 6240 | /* Start with output sum widgets muted and their output gains at min */ |
| 6241 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6242 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6243 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6244 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6245 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6246 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6247 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6248 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6249 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6250 | |
| 6251 | /* Unmute Line-out pin widget amp left and right |
| 6252 | * (no equiv mixer ctrl) |
| 6253 | */ |
| 6254 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6255 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6256 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6257 | * will take care of enabling the pin's input/output buffers as needed. |
| 6258 | * Therefore there's no need to enable the input buffer at this |
| 6259 | * stage. |
| 6260 | */ |
| 6261 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6262 | |
| 6263 | /* Mute capture amp left and right */ |
| 6264 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6265 | /* Set ADC connection select to match default mixer setting - mic |
| 6266 | * (on mic1 pin) |
| 6267 | */ |
| 6268 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6269 | |
| 6270 | /* Do similar with the second ADC: mute capture input amp and |
| 6271 | * set ADC connection to mic to match ALSA's default state. |
| 6272 | */ |
| 6273 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6274 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6275 | |
| 6276 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6277 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6278 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6279 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6280 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6281 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6282 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6283 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6284 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6285 | |
| 6286 | { } |
| 6287 | }; |
| 6288 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6289 | static struct hda_verb alc260_will_verbs[] = { |
| 6290 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6291 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6292 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6293 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6294 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6295 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6296 | {} |
| 6297 | }; |
| 6298 | |
| 6299 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6300 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6301 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6302 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6303 | |
| 6304 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6305 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6306 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6307 | |
| 6308 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6309 | {} |
| 6310 | }; |
| 6311 | |
| 6312 | /* toggle speaker-output according to the hp-jack state */ |
| 6313 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6314 | { |
| 6315 | unsigned int present; |
| 6316 | |
| 6317 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6318 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6319 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6320 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6321 | AC_VERB_SET_GPIO_DATA, 1); |
| 6322 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6323 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6324 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6325 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6326 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6327 | AC_VERB_SET_GPIO_DATA, 0); |
| 6328 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6329 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6330 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6331 | } |
| 6332 | } |
| 6333 | |
| 6334 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6335 | unsigned int res) |
| 6336 | { |
| 6337 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6338 | alc260_replacer_672v_automute(codec); |
| 6339 | } |
| 6340 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6341 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6342 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6343 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6344 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6345 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6346 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6347 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6348 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6349 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6350 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6351 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6352 | {} |
| 6353 | }; |
| 6354 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6355 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6356 | * configuration. |
| 6357 | */ |
| 6358 | #ifdef CONFIG_SND_DEBUG |
| 6359 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6360 | 0x02, |
| 6361 | }; |
| 6362 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6363 | 0x04, 0x05, |
| 6364 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6365 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6366 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6367 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6368 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6369 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6370 | { |
| 6371 | .num_items = 7, |
| 6372 | .items = { |
| 6373 | { "MIC1 pin", 0x0 }, |
| 6374 | { "MIC2 pin", 0x1 }, |
| 6375 | { "LINE1 pin", 0x2 }, |
| 6376 | { "LINE2 pin", 0x3 }, |
| 6377 | { "CD pin", 0x4 }, |
| 6378 | { "LINE-OUT pin", 0x5 }, |
| 6379 | { "HP-OUT pin", 0x6 }, |
| 6380 | }, |
| 6381 | }, |
| 6382 | { |
| 6383 | .num_items = 8, |
| 6384 | .items = { |
| 6385 | { "MIC1 pin", 0x0 }, |
| 6386 | { "MIC2 pin", 0x1 }, |
| 6387 | { "LINE1 pin", 0x2 }, |
| 6388 | { "LINE2 pin", 0x3 }, |
| 6389 | { "CD pin", 0x4 }, |
| 6390 | { "Mixer", 0x5 }, |
| 6391 | { "LINE-OUT pin", 0x6 }, |
| 6392 | { "HP-OUT pin", 0x7 }, |
| 6393 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6394 | }, |
| 6395 | }; |
| 6396 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6397 | /* Output driver widgets */ |
| 6398 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6399 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6400 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6401 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6402 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6403 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6404 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6405 | /* Modes for retasking pin widgets |
| 6406 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6407 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6408 | * mention this restriction. At this stage it's not clear whether |
| 6409 | * this behaviour is intentional or is a hardware bug in chip |
| 6410 | * revisions available at least up until early 2006. Therefore for |
| 6411 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6412 | * choices, but if it turns out that the lack of mic bias for these |
| 6413 | * NIDs is intentional we could change their modes from |
| 6414 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6415 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6416 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6417 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6418 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6419 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6420 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6421 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6422 | |
| 6423 | /* Loopback mixer controls */ |
| 6424 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6425 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6426 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6427 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6428 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6429 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6430 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6431 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6432 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6433 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6434 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6435 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6436 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6437 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6438 | |
| 6439 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6440 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6441 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6442 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6443 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6444 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6445 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6446 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6447 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6448 | */ |
| 6449 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6450 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6451 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6452 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6453 | * this output to turn on an external amplifier. |
| 6454 | */ |
| 6455 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6456 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6457 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6458 | { } /* end */ |
| 6459 | }; |
| 6460 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6461 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6462 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6463 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6464 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6465 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6466 | /* Enable retasking pins as output, initially without power amp */ |
| 6467 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6468 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6469 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6470 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6471 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6472 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6473 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6474 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6475 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6476 | * payload also sets the generation to 0, output to be in "consumer" |
| 6477 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6478 | * control. |
| 6479 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6480 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6481 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6482 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6483 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6484 | * OUT1 sum bus when acting as an output. |
| 6485 | */ |
| 6486 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6487 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6488 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6489 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6490 | |
| 6491 | /* Start with output sum widgets muted and their output gains at min */ |
| 6492 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6493 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6494 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6495 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6496 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6497 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6498 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6499 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6500 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6501 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6502 | /* Unmute retasking pin widget output buffers since the default |
| 6503 | * state appears to be output. As the pin mode is changed by the |
| 6504 | * user the pin mode control will take care of enabling the pin's |
| 6505 | * input/output buffers as needed. |
| 6506 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6507 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6508 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6509 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6510 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6511 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6512 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6513 | /* Also unmute the mono-out pin widget */ |
| 6514 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6515 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6516 | /* Mute capture amp left and right */ |
| 6517 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6518 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6519 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6520 | */ |
| 6521 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6522 | |
| 6523 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6524 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6525 | */ |
| 6526 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6527 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6528 | |
| 6529 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6530 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6531 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6532 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6533 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6534 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6535 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6536 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6537 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6538 | |
| 6539 | { } |
| 6540 | }; |
| 6541 | #endif |
| 6542 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6543 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6544 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6545 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6546 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6547 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6548 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6549 | /* |
| 6550 | * for BIOS auto-configuration |
| 6551 | */ |
| 6552 | |
| 6553 | 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] | 6554 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6555 | { |
| 6556 | hda_nid_t nid_vol; |
| 6557 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6558 | int err; |
| 6559 | |
| 6560 | if (nid >= 0x0f && nid < 0x11) { |
| 6561 | nid_vol = nid - 0x7; |
| 6562 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6563 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6564 | } else if (nid == 0x11) { |
| 6565 | nid_vol = nid - 0x7; |
| 6566 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6567 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6568 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6569 | nid_vol = 0x08; |
| 6570 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6571 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6572 | } else |
| 6573 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6574 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6575 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6576 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6577 | 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] | 6578 | if (err < 0) |
| 6579 | return err; |
| 6580 | *vol_bits |= (1 << nid_vol); |
| 6581 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6582 | 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] | 6583 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6584 | return err; |
| 6585 | return 1; |
| 6586 | } |
| 6587 | |
| 6588 | /* add playback controls from the parsed DAC table */ |
| 6589 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6590 | const struct auto_pin_cfg *cfg) |
| 6591 | { |
| 6592 | hda_nid_t nid; |
| 6593 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6594 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6595 | |
| 6596 | spec->multiout.num_dacs = 1; |
| 6597 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6598 | spec->multiout.dac_nids[0] = 0x02; |
| 6599 | |
| 6600 | nid = cfg->line_out_pins[0]; |
| 6601 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6602 | const char *pfx; |
| 6603 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6604 | pfx = "Master"; |
| 6605 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6606 | pfx = "Speaker"; |
| 6607 | else |
| 6608 | pfx = "Front"; |
| 6609 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6610 | if (err < 0) |
| 6611 | return err; |
| 6612 | } |
| 6613 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6614 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6615 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6616 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6617 | if (err < 0) |
| 6618 | return err; |
| 6619 | } |
| 6620 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6621 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6622 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6623 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6624 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6625 | if (err < 0) |
| 6626 | return err; |
| 6627 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6628 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6629 | } |
| 6630 | |
| 6631 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6632 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6633 | const struct auto_pin_cfg *cfg) |
| 6634 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6635 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6636 | } |
| 6637 | |
| 6638 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6639 | hda_nid_t nid, int pin_type, |
| 6640 | int sel_idx) |
| 6641 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6642 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6643 | /* need the manual connection? */ |
| 6644 | if (nid >= 0x12) { |
| 6645 | int idx = nid - 0x12; |
| 6646 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6647 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6648 | } |
| 6649 | } |
| 6650 | |
| 6651 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6652 | { |
| 6653 | struct alc_spec *spec = codec->spec; |
| 6654 | hda_nid_t nid; |
| 6655 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6656 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6657 | if (nid) { |
| 6658 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6659 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6660 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6661 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6662 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6663 | if (nid) |
| 6664 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6665 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6666 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6667 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6668 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6669 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6670 | |
| 6671 | #define ALC260_PIN_CD_NID 0x16 |
| 6672 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6673 | { |
| 6674 | struct alc_spec *spec = codec->spec; |
| 6675 | int i; |
| 6676 | |
| 6677 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6678 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6679 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6680 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6681 | if (nid != ALC260_PIN_CD_NID && |
| 6682 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6683 | snd_hda_codec_write(codec, nid, 0, |
| 6684 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6685 | AMP_OUT_MUTE); |
| 6686 | } |
| 6687 | } |
| 6688 | } |
| 6689 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6690 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 6691 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6692 | /* |
| 6693 | * generic initialization of ADC, input mixers and output mixers |
| 6694 | */ |
| 6695 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6696 | /* |
| 6697 | * Unmute ADC0-1 and set the default input to mic-in |
| 6698 | */ |
| 6699 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6700 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6701 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6702 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6703 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6704 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6705 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6706 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6707 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6708 | */ |
| 6709 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6710 | /* mute analog inputs */ |
| 6711 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6712 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6713 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6714 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6715 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6716 | |
| 6717 | /* |
| 6718 | * Set up output mixers (0x08 - 0x0a) |
| 6719 | */ |
| 6720 | /* set vol=0 to output mixers */ |
| 6721 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6722 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6723 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6724 | /* set up input amps for analog loopback */ |
| 6725 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6726 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6727 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6728 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6729 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6730 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6731 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6732 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6733 | { } |
| 6734 | }; |
| 6735 | |
| 6736 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6737 | { |
| 6738 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6739 | int err; |
| 6740 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6741 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6742 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6743 | alc260_ignore); |
| 6744 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6745 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6746 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6747 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6748 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6749 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6750 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6751 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6752 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6753 | return err; |
| 6754 | |
| 6755 | spec->multiout.max_channels = 2; |
| 6756 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6757 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6758 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6759 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6760 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6761 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6762 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6763 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6764 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6765 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6766 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 6767 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6768 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6769 | return 1; |
| 6770 | } |
| 6771 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6772 | /* additional initialization for auto-configuration model */ |
| 6773 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6774 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6775 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6776 | alc260_auto_init_multi_out(codec); |
| 6777 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6778 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 6779 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6780 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6781 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6782 | } |
| 6783 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6784 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6785 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6786 | { 0x07, HDA_INPUT, 0 }, |
| 6787 | { 0x07, HDA_INPUT, 1 }, |
| 6788 | { 0x07, HDA_INPUT, 2 }, |
| 6789 | { 0x07, HDA_INPUT, 3 }, |
| 6790 | { 0x07, HDA_INPUT, 4 }, |
| 6791 | { } /* end */ |
| 6792 | }; |
| 6793 | #endif |
| 6794 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6795 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 6796 | * Pin config fixes |
| 6797 | */ |
| 6798 | enum { |
| 6799 | PINFIX_HP_DC5750, |
| 6800 | }; |
| 6801 | |
| 6802 | static struct alc_pincfg alc260_hp_dc5750_pinfix[] = { |
| 6803 | { 0x11, 0x90130110 }, /* speaker */ |
| 6804 | { } |
| 6805 | }; |
| 6806 | |
| 6807 | static const struct alc_fixup alc260_fixups[] = { |
| 6808 | [PINFIX_HP_DC5750] = { |
| 6809 | .pins = alc260_hp_dc5750_pinfix |
| 6810 | }, |
| 6811 | }; |
| 6812 | |
| 6813 | static struct snd_pci_quirk alc260_fixup_tbl[] = { |
| 6814 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 6815 | {} |
| 6816 | }; |
| 6817 | |
| 6818 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6819 | * ALC260 configurations |
| 6820 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6821 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6822 | [ALC260_BASIC] = "basic", |
| 6823 | [ALC260_HP] = "hp", |
| 6824 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6825 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6826 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6827 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6828 | [ALC260_WILL] = "will", |
| 6829 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6830 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6831 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6832 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6833 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6834 | [ALC260_AUTO] = "auto", |
| 6835 | }; |
| 6836 | |
| 6837 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6838 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 6839 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6840 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6841 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6842 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 6843 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6844 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6845 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6846 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6847 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6848 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6849 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6850 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6851 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6852 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6853 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6854 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6855 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6856 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6857 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6858 | {} |
| 6859 | }; |
| 6860 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6861 | static struct alc_config_preset alc260_presets[] = { |
| 6862 | [ALC260_BASIC] = { |
| 6863 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6864 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6865 | .init_verbs = { alc260_init_verbs }, |
| 6866 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6867 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6868 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 6869 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6870 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6871 | .channel_mode = alc260_modes, |
| 6872 | .input_mux = &alc260_capture_source, |
| 6873 | }, |
| 6874 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6875 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6876 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6877 | .init_verbs = { alc260_init_verbs, |
| 6878 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6879 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6880 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6881 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6882 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6883 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6884 | .channel_mode = alc260_modes, |
| 6885 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6886 | .unsol_event = alc260_hp_unsol_event, |
| 6887 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6888 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6889 | [ALC260_HP_DC7600] = { |
| 6890 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6891 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6892 | .init_verbs = { alc260_init_verbs, |
| 6893 | alc260_hp_dc7600_verbs }, |
| 6894 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6895 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6896 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6897 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6898 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6899 | .channel_mode = alc260_modes, |
| 6900 | .input_mux = &alc260_capture_source, |
| 6901 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6902 | .init_hook = alc260_hp_3012_automute, |
| 6903 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6904 | [ALC260_HP_3013] = { |
| 6905 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6906 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6907 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6908 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6909 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6910 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6911 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6912 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6913 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6914 | .channel_mode = alc260_modes, |
| 6915 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6916 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6917 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6918 | }, |
| 6919 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6920 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6921 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6922 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6923 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6924 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6925 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6926 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6927 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6928 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6929 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6930 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6931 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6932 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6933 | .init_verbs = { alc260_acer_init_verbs }, |
| 6934 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6935 | .dac_nids = alc260_dac_nids, |
| 6936 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6937 | .adc_nids = alc260_dual_adc_nids, |
| 6938 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6939 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6940 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6941 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6942 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6943 | [ALC260_FAVORIT100] = { |
| 6944 | .mixers = { alc260_favorit100_mixer }, |
| 6945 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6946 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6947 | .dac_nids = alc260_dac_nids, |
| 6948 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6949 | .adc_nids = alc260_dual_adc_nids, |
| 6950 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6951 | .channel_mode = alc260_modes, |
| 6952 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6953 | .input_mux = alc260_favorit100_capture_sources, |
| 6954 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6955 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6956 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6957 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6958 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6959 | .dac_nids = alc260_dac_nids, |
| 6960 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6961 | .adc_nids = alc260_adc_nids, |
| 6962 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6963 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6964 | .channel_mode = alc260_modes, |
| 6965 | .input_mux = &alc260_capture_source, |
| 6966 | }, |
| 6967 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6968 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6969 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6970 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6971 | .dac_nids = alc260_dac_nids, |
| 6972 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6973 | .adc_nids = alc260_adc_nids, |
| 6974 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6975 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6976 | .channel_mode = alc260_modes, |
| 6977 | .input_mux = &alc260_capture_source, |
| 6978 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6979 | .init_hook = alc260_replacer_672v_automute, |
| 6980 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6981 | #ifdef CONFIG_SND_DEBUG |
| 6982 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6983 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6984 | .init_verbs = { alc260_test_init_verbs }, |
| 6985 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6986 | .dac_nids = alc260_test_dac_nids, |
| 6987 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6988 | .adc_nids = alc260_test_adc_nids, |
| 6989 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6990 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6991 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6992 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6993 | }, |
| 6994 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6995 | }; |
| 6996 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6997 | static int patch_alc260(struct hda_codec *codec) |
| 6998 | { |
| 6999 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7000 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7001 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7002 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7003 | if (spec == NULL) |
| 7004 | return -ENOMEM; |
| 7005 | |
| 7006 | codec->spec = spec; |
| 7007 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7008 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7009 | alc260_models, |
| 7010 | alc260_cfg_tbl); |
| 7011 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7012 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7013 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7014 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7015 | } |
| 7016 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7017 | if (board_config == ALC260_AUTO) |
| 7018 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1); |
| 7019 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7020 | if (board_config == ALC260_AUTO) { |
| 7021 | /* automatic parse from the BIOS config */ |
| 7022 | err = alc260_parse_auto_config(codec); |
| 7023 | if (err < 0) { |
| 7024 | alc_free(codec); |
| 7025 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7026 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7027 | printk(KERN_INFO |
| 7028 | "hda_codec: Cannot set up configuration " |
| 7029 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7030 | board_config = ALC260_BASIC; |
| 7031 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7032 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7033 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7034 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7035 | if (err < 0) { |
| 7036 | alc_free(codec); |
| 7037 | return err; |
| 7038 | } |
| 7039 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7040 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7041 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7042 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7043 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7044 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7045 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7046 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7047 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7048 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7049 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7050 | if (!spec->adc_nids && spec->input_mux) { |
| 7051 | /* check whether NID 0x04 is valid */ |
| 7052 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7053 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7054 | /* get type */ |
| 7055 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7056 | spec->adc_nids = alc260_adc_nids_alt; |
| 7057 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7058 | } else { |
| 7059 | spec->adc_nids = alc260_adc_nids; |
| 7060 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7061 | } |
| 7062 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7063 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7064 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7065 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7066 | if (board_config == ALC260_AUTO) |
| 7067 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0); |
| 7068 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7069 | spec->vmaster_nid = 0x08; |
| 7070 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7071 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7072 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7073 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7074 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7075 | if (!spec->loopback.amplist) |
| 7076 | spec->loopback.amplist = alc260_loopbacks; |
| 7077 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7078 | |
| 7079 | return 0; |
| 7080 | } |
| 7081 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7082 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7083 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7084 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7085 | * |
| 7086 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7087 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7088 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7089 | * 6-channel independent captures. |
| 7090 | * |
| 7091 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7092 | * driver yet). |
| 7093 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7094 | #define ALC882_DIGOUT_NID 0x06 |
| 7095 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7096 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7097 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7098 | #define ALC1200_DIGOUT_NID 0x10 |
| 7099 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7100 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7101 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7102 | { 8, NULL } |
| 7103 | }; |
| 7104 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7105 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7106 | static hda_nid_t alc882_dac_nids[4] = { |
| 7107 | /* front, rear, clfe, rear_surr */ |
| 7108 | 0x02, 0x03, 0x04, 0x05 |
| 7109 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7110 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7111 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7112 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7113 | #define alc882_adc_nids alc880_adc_nids |
| 7114 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7115 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7116 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7117 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7118 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7119 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7120 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7121 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7122 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7123 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7124 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7125 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7126 | /* input MUX */ |
| 7127 | /* FIXME: should be a matrix-type input source selection */ |
| 7128 | |
| 7129 | static struct hda_input_mux alc882_capture_source = { |
| 7130 | .num_items = 4, |
| 7131 | .items = { |
| 7132 | { "Mic", 0x0 }, |
| 7133 | { "Front Mic", 0x1 }, |
| 7134 | { "Line", 0x2 }, |
| 7135 | { "CD", 0x4 }, |
| 7136 | }, |
| 7137 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7138 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7139 | #define alc883_capture_source alc882_capture_source |
| 7140 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7141 | static struct hda_input_mux alc889_capture_source = { |
| 7142 | .num_items = 3, |
| 7143 | .items = { |
| 7144 | { "Front Mic", 0x0 }, |
| 7145 | { "Mic", 0x3 }, |
| 7146 | { "Line", 0x2 }, |
| 7147 | }, |
| 7148 | }; |
| 7149 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7150 | static struct hda_input_mux mb5_capture_source = { |
| 7151 | .num_items = 3, |
| 7152 | .items = { |
| 7153 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7154 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7155 | { "CD", 0x4 }, |
| 7156 | }, |
| 7157 | }; |
| 7158 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7159 | static struct hda_input_mux macmini3_capture_source = { |
| 7160 | .num_items = 2, |
| 7161 | .items = { |
| 7162 | { "Line", 0x2 }, |
| 7163 | { "CD", 0x4 }, |
| 7164 | }, |
| 7165 | }; |
| 7166 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7167 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7168 | .num_items = 4, |
| 7169 | .items = { |
| 7170 | { "Mic", 0x1 }, |
| 7171 | { "Front Mic", 0x0 }, |
| 7172 | { "Line", 0x2 }, |
| 7173 | { "CD", 0x4 }, |
| 7174 | }, |
| 7175 | }; |
| 7176 | |
| 7177 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7178 | .num_items = 2, |
| 7179 | .items = { |
| 7180 | { "Mic", 0x1 }, |
| 7181 | { "Line", 0x2 }, |
| 7182 | }, |
| 7183 | }; |
| 7184 | |
| 7185 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7186 | .num_items = 4, |
| 7187 | .items = { |
| 7188 | { "Mic", 0x0 }, |
David Henningsson | 150b432 | 2010-07-29 14:46:42 +0200 | [diff] [blame] | 7189 | { "Int Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7190 | { "Line", 0x2 }, |
| 7191 | { "CD", 0x4 }, |
| 7192 | }, |
| 7193 | }; |
| 7194 | |
| 7195 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7196 | .num_items = 2, |
| 7197 | .items = { |
| 7198 | { "Mic", 0x0 }, |
| 7199 | { "Int Mic", 0x1 }, |
| 7200 | }, |
| 7201 | }; |
| 7202 | |
| 7203 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7204 | .num_items = 3, |
| 7205 | .items = { |
| 7206 | { "Mic", 0x0 }, |
| 7207 | { "Front Mic", 0x1 }, |
| 7208 | { "Line", 0x4 }, |
| 7209 | }, |
| 7210 | }; |
| 7211 | |
| 7212 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7213 | .num_items = 2, |
| 7214 | .items = { |
| 7215 | { "Mic", 0x0 }, |
| 7216 | { "Line", 0x2 }, |
| 7217 | }, |
| 7218 | }; |
| 7219 | |
| 7220 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7221 | .num_items = 2, |
| 7222 | .items = { |
| 7223 | { "Mic", 0x0 }, |
| 7224 | /* Front Mic (0x01) unused */ |
| 7225 | { "Line", 0x2 }, |
| 7226 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7227 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7228 | }, |
| 7229 | }; |
| 7230 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7231 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7232 | .num_items = 2, |
| 7233 | .items = { |
| 7234 | { "Mic", 0x01 }, |
| 7235 | { "Line", 0x2 }, /* Not sure! */ |
| 7236 | }, |
| 7237 | }; |
| 7238 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7239 | /* |
| 7240 | * 2ch mode |
| 7241 | */ |
| 7242 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7243 | { 2, NULL } |
| 7244 | }; |
| 7245 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7246 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7247 | * 2ch mode |
| 7248 | */ |
| 7249 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7250 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7251 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7252 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7253 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7254 | { } /* end */ |
| 7255 | }; |
| 7256 | |
| 7257 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7258 | * 4ch mode |
| 7259 | */ |
| 7260 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7261 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7262 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7263 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7264 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7265 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7266 | { } /* end */ |
| 7267 | }; |
| 7268 | |
| 7269 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7270 | * 6ch mode |
| 7271 | */ |
| 7272 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7273 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7274 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7275 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7276 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7277 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7278 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7279 | { } /* end */ |
| 7280 | }; |
| 7281 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7282 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7283 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7284 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7285 | { 6, alc882_3ST_ch6_init }, |
| 7286 | }; |
| 7287 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7288 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7289 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7290 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7291 | * 2ch mode |
| 7292 | */ |
| 7293 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7294 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7295 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7296 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7297 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7298 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7299 | { } /* end */ |
| 7300 | }; |
| 7301 | |
| 7302 | /* |
| 7303 | * 4ch mode |
| 7304 | */ |
| 7305 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7306 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7307 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7308 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7309 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7310 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7311 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7312 | { } /* end */ |
| 7313 | }; |
| 7314 | |
| 7315 | /* |
| 7316 | * 6ch mode |
| 7317 | */ |
| 7318 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7319 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7320 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7321 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7322 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7323 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7324 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7325 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7326 | { } /* end */ |
| 7327 | }; |
| 7328 | |
| 7329 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7330 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7331 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7332 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7333 | }; |
| 7334 | |
| 7335 | |
| 7336 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7337 | * 6ch mode |
| 7338 | */ |
| 7339 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7340 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7341 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7342 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7343 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7344 | { } /* end */ |
| 7345 | }; |
| 7346 | |
| 7347 | /* |
| 7348 | * 8ch mode |
| 7349 | */ |
| 7350 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7351 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7352 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7353 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7354 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7355 | { } /* end */ |
| 7356 | }; |
| 7357 | |
| 7358 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7359 | { 6, alc882_sixstack_ch6_init }, |
| 7360 | { 8, alc882_sixstack_ch8_init }, |
| 7361 | }; |
| 7362 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7363 | |
| 7364 | /* Macbook Air 2,1 */ |
| 7365 | |
| 7366 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7367 | { 2, NULL }, |
| 7368 | }; |
| 7369 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7370 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7371 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7372 | */ |
| 7373 | |
| 7374 | /* |
| 7375 | * 2ch mode |
| 7376 | */ |
| 7377 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7378 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7379 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7380 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7381 | { } /* end */ |
| 7382 | }; |
| 7383 | |
| 7384 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7385 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7386 | */ |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7387 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7388 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7389 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7390 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7391 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7392 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7393 | { } /* end */ |
| 7394 | }; |
| 7395 | |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7396 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7397 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7398 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7399 | }; |
| 7400 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7401 | /* |
| 7402 | * 2ch |
| 7403 | * Speakers/Woofer/HP = Front |
| 7404 | * LineIn = Input |
| 7405 | */ |
| 7406 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7407 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7408 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7409 | { } /* end */ |
| 7410 | }; |
| 7411 | |
| 7412 | /* |
| 7413 | * 6ch mode |
| 7414 | * Speakers/HP = Front |
| 7415 | * Woofer = LFE |
| 7416 | * LineIn = Surround |
| 7417 | */ |
| 7418 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7419 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7420 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7421 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7422 | { } /* end */ |
| 7423 | }; |
| 7424 | |
| 7425 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7426 | { 2, alc885_mb5_ch2_init }, |
| 7427 | { 6, alc885_mb5_ch6_init }, |
| 7428 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7429 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7430 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7431 | |
| 7432 | /* |
| 7433 | * 2ch mode |
| 7434 | */ |
| 7435 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7436 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7437 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7438 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7439 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7440 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7441 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7442 | { } /* end */ |
| 7443 | }; |
| 7444 | |
| 7445 | /* |
| 7446 | * 4ch mode |
| 7447 | */ |
| 7448 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7449 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7450 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7451 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7452 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7453 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7454 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7455 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7456 | { } /* end */ |
| 7457 | }; |
| 7458 | |
| 7459 | /* |
| 7460 | * 6ch mode |
| 7461 | */ |
| 7462 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7463 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7464 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7465 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7466 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7467 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7468 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7469 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7470 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7471 | { } /* end */ |
| 7472 | }; |
| 7473 | |
| 7474 | /* |
| 7475 | * 8ch mode |
| 7476 | */ |
| 7477 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7478 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7479 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7480 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7481 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7482 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7483 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7484 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7485 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7486 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7487 | { } /* end */ |
| 7488 | }; |
| 7489 | |
| 7490 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7491 | { 2, alc883_4ST_ch2_init }, |
| 7492 | { 4, alc883_4ST_ch4_init }, |
| 7493 | { 6, alc883_4ST_ch6_init }, |
| 7494 | { 8, alc883_4ST_ch8_init }, |
| 7495 | }; |
| 7496 | |
| 7497 | |
| 7498 | /* |
| 7499 | * 2ch mode |
| 7500 | */ |
| 7501 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7502 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7503 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7504 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7505 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7506 | { } /* end */ |
| 7507 | }; |
| 7508 | |
| 7509 | /* |
| 7510 | * 4ch mode |
| 7511 | */ |
| 7512 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7513 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7514 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7515 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7516 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7517 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7518 | { } /* end */ |
| 7519 | }; |
| 7520 | |
| 7521 | /* |
| 7522 | * 6ch mode |
| 7523 | */ |
| 7524 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7525 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7526 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7527 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7528 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7529 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7530 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7531 | { } /* end */ |
| 7532 | }; |
| 7533 | |
| 7534 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7535 | { 2, alc883_3ST_ch2_intel_init }, |
| 7536 | { 4, alc883_3ST_ch4_intel_init }, |
| 7537 | { 6, alc883_3ST_ch6_intel_init }, |
| 7538 | }; |
| 7539 | |
| 7540 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7541 | * 2ch mode |
| 7542 | */ |
| 7543 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7544 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7545 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7546 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7547 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7548 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7549 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7550 | { } /* end */ |
| 7551 | }; |
| 7552 | |
| 7553 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7554 | * 6ch mode |
| 7555 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7556 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7557 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7558 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7559 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7560 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7561 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7562 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7563 | { } /* end */ |
| 7564 | }; |
| 7565 | |
| 7566 | /* |
| 7567 | * 8ch mode |
| 7568 | */ |
| 7569 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7570 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7571 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7572 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7573 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7574 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7575 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7576 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7577 | { } /* end */ |
| 7578 | }; |
| 7579 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7580 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7581 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7582 | { 6, alc889_ch6_intel_init }, |
| 7583 | { 8, alc889_ch8_intel_init }, |
| 7584 | }; |
| 7585 | |
| 7586 | /* |
| 7587 | * 6ch mode |
| 7588 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7589 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7590 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7591 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7592 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7593 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7594 | { } /* end */ |
| 7595 | }; |
| 7596 | |
| 7597 | /* |
| 7598 | * 8ch mode |
| 7599 | */ |
| 7600 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7601 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7602 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7603 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7604 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7605 | { } /* end */ |
| 7606 | }; |
| 7607 | |
| 7608 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7609 | { 6, alc883_sixstack_ch6_init }, |
| 7610 | { 8, alc883_sixstack_ch8_init }, |
| 7611 | }; |
| 7612 | |
| 7613 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7614 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7615 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7616 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7617 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7618 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7619 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7620 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7621 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7622 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7623 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7624 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7625 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7626 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7627 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7628 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7629 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7630 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7631 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7632 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7633 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7634 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7635 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7636 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7637 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7638 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7639 | { } /* end */ |
| 7640 | }; |
| 7641 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7642 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 7643 | |
| 7644 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 7645 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7646 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 7647 | { } |
| 7648 | }; |
| 7649 | |
| 7650 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7651 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7652 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7653 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7654 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7655 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7656 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7657 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7658 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7659 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7660 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7661 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7662 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7663 | { } /* end */ |
| 7664 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7665 | |
| 7666 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7667 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7668 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7669 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7670 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7671 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7672 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7673 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7674 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7675 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7676 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7677 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7678 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7679 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7680 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7681 | { } /* end */ |
| 7682 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7683 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7684 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 7685 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7686 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7687 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7688 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7689 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7690 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7691 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7692 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 7693 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7694 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 7695 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7696 | { } /* end */ |
| 7697 | }; |
| 7698 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7699 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7700 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7701 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7702 | { } /* end */ |
| 7703 | }; |
| 7704 | |
| 7705 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7706 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7707 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7708 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7709 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7710 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7711 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7712 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7713 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7714 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7715 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7716 | { } /* end */ |
| 7717 | }; |
| 7718 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7719 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7720 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7721 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7722 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7723 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7724 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7725 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7726 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7727 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7728 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7729 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7730 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7731 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7732 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7733 | { } /* end */ |
| 7734 | }; |
| 7735 | |
| 7736 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7737 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7738 | */ |
| 7739 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7740 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7741 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7742 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7743 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7744 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7745 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7746 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7747 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7748 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7749 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7750 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7751 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7752 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7753 | { } /* end */ |
| 7754 | }; |
| 7755 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7756 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7757 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7758 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7759 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7760 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7761 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7762 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7763 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7764 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7765 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7766 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7767 | { } /* end */ |
| 7768 | }; |
| 7769 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7770 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7771 | { |
| 7772 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7773 | .name = "Channel Mode", |
| 7774 | .info = alc_ch_mode_info, |
| 7775 | .get = alc_ch_mode_get, |
| 7776 | .put = alc_ch_mode_put, |
| 7777 | }, |
| 7778 | { } /* end */ |
| 7779 | }; |
| 7780 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7781 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7782 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7783 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7784 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7785 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7786 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7787 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7788 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7789 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7790 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7791 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7792 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7793 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7794 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7795 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7796 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7797 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7798 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7799 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7800 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7801 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7802 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7803 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7804 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7805 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7806 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7807 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7808 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7809 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7810 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7811 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7812 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7813 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7814 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7815 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7816 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7817 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7818 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7819 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7820 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7821 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7822 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7823 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7824 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7825 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7826 | |
| 7827 | /* FIXME: use matrix-type input source selection */ |
| 7828 | /* 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] | 7829 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7830 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7831 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7832 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7833 | /* ADC2: mute amp left and right */ |
| 7834 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7835 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7836 | /* ADC3: mute amp left and right */ |
| 7837 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7838 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7839 | |
| 7840 | { } |
| 7841 | }; |
| 7842 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7843 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7844 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7845 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7846 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7847 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7848 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7849 | /* ADC1: mute amp left and right */ |
| 7850 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7851 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7852 | { } |
| 7853 | }; |
| 7854 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7855 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7856 | /* change to EAPD mode */ |
| 7857 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7858 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7859 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7860 | }; |
| 7861 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7862 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7863 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7864 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7865 | { } |
| 7866 | }; |
| 7867 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7868 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7869 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7870 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7871 | {} |
| 7872 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7873 | |
| 7874 | static struct hda_verb alc885_init_verbs[] = { |
| 7875 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7876 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7877 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7878 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7879 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7880 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7881 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7882 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7883 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7884 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7885 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7886 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7887 | |
| 7888 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7889 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7890 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7891 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7892 | /* Front Pin: output 0 (0x0c) */ |
| 7893 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7894 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7895 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7896 | /* Rear Pin: output 1 (0x0d) */ |
| 7897 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7898 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7899 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7900 | /* CLFE Pin: output 2 (0x0e) */ |
| 7901 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7902 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7903 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7904 | /* Side Pin: output 3 (0x0f) */ |
| 7905 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7906 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7907 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7908 | /* Mic (rear) pin: input vref at 80% */ |
| 7909 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7910 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7911 | /* Front Mic pin: input vref at 80% */ |
| 7912 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7913 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7914 | /* Line In pin: input */ |
| 7915 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7916 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7917 | |
| 7918 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7919 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7920 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7921 | /* Input mixer2 */ |
| 7922 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7923 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7924 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7925 | /* ADC2: mute amp left and right */ |
| 7926 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7927 | /* ADC3: mute amp left and right */ |
| 7928 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7929 | |
| 7930 | { } |
| 7931 | }; |
| 7932 | |
| 7933 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7934 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7935 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7936 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7937 | { } |
| 7938 | }; |
| 7939 | |
| 7940 | |
| 7941 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7942 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7943 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7944 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7945 | { } |
| 7946 | }; |
| 7947 | |
| 7948 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7949 | #define alc883_init_verbs alc882_base_init_verbs |
| 7950 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7951 | /* Mac Pro test */ |
| 7952 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7953 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7954 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7955 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7956 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7957 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7958 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 7959 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7960 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7961 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7962 | { } /* end */ |
| 7963 | }; |
| 7964 | |
| 7965 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7966 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7967 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7968 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7969 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7970 | /* Front Pin: output 0 (0x0c) */ |
| 7971 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7972 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7973 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7974 | /* Front Mic pin: input vref at 80% */ |
| 7975 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7976 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7977 | /* Speaker: output */ |
| 7978 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7979 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7980 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7981 | /* Headphone output (output 0 - 0x0c) */ |
| 7982 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7983 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7984 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7985 | |
| 7986 | /* FIXME: use matrix-type input source selection */ |
| 7987 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7988 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7989 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7990 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7991 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7992 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7993 | /* Input mixer2 */ |
| 7994 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7995 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7996 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7997 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7998 | /* Input mixer3 */ |
| 7999 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8000 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8001 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8002 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8003 | /* ADC1: mute amp left and right */ |
| 8004 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8005 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8006 | /* ADC2: mute amp left and right */ |
| 8007 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8008 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8009 | /* ADC3: mute amp left and right */ |
| 8010 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8011 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8012 | |
| 8013 | { } |
| 8014 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8015 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8016 | /* Macbook 5,1 */ |
| 8017 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8018 | /* DACs */ |
| 8019 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8020 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8021 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8022 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8023 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8024 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8025 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8026 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8027 | /* Surround mixer */ |
| 8028 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8029 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8030 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8031 | /* LFE mixer */ |
| 8032 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8033 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8034 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8035 | /* HP mixer */ |
| 8036 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8037 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8038 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8039 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8040 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8041 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8042 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8043 | /* LFE Pin (0x0e) */ |
| 8044 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8045 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8046 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8047 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8048 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8049 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8050 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8051 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8052 | /* Front Mic pin: input vref at 80% */ |
| 8053 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8054 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8055 | /* Line In pin */ |
| 8056 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8057 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8058 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8059 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8060 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8061 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8062 | { } |
| 8063 | }; |
| 8064 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8065 | /* Macmini 3,1 */ |
| 8066 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 8067 | /* DACs */ |
| 8068 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8069 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8070 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8071 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8072 | /* Front mixer */ |
| 8073 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8074 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8075 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8076 | /* Surround mixer */ |
| 8077 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8078 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8079 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8080 | /* LFE mixer */ |
| 8081 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8082 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8083 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8084 | /* HP mixer */ |
| 8085 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8086 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8087 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8088 | /* Front Pin (0x0c) */ |
| 8089 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8090 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8091 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8092 | /* LFE Pin (0x0e) */ |
| 8093 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8094 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8095 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8096 | /* HP Pin (0x0f) */ |
| 8097 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8098 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8099 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8100 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8101 | /* Line In pin */ |
| 8102 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8103 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8104 | |
| 8105 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8106 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8107 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8108 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8109 | { } |
| 8110 | }; |
| 8111 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8112 | |
| 8113 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8114 | /*Internal and HP Speaker Mixer*/ |
| 8115 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8116 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8117 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8118 | /*Internal Speaker Pin (0x0c)*/ |
| 8119 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8120 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8121 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8122 | /* HP Pin: output 0 (0x0e) */ |
| 8123 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8124 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8125 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8126 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8127 | /* Line in (is hp when jack connected)*/ |
| 8128 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8129 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8130 | |
| 8131 | { } |
| 8132 | }; |
| 8133 | |
| 8134 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8135 | /* Macbook Pro rev3 */ |
| 8136 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8137 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8138 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8139 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8140 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8141 | /* Rear mixer */ |
| 8142 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8143 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8144 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8145 | /* HP mixer */ |
| 8146 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8147 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8148 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8149 | /* Front Pin: output 0 (0x0c) */ |
| 8150 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8151 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8152 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8153 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8154 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8155 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8156 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8157 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8158 | /* Mic (rear) pin: input vref at 80% */ |
| 8159 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8160 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8161 | /* Front Mic pin: input vref at 80% */ |
| 8162 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8163 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8164 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8165 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8166 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8167 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8168 | |
| 8169 | /* FIXME: use matrix-type input source selection */ |
| 8170 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8171 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8172 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8173 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8174 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8175 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8176 | /* Input mixer2 */ |
| 8177 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8178 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8179 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8180 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8181 | /* Input mixer3 */ |
| 8182 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8183 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8184 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8185 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8186 | /* ADC1: mute amp left and right */ |
| 8187 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8188 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8189 | /* ADC2: mute amp left and right */ |
| 8190 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8191 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8192 | /* ADC3: mute amp left and right */ |
| 8193 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8194 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8195 | |
| 8196 | { } |
| 8197 | }; |
| 8198 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8199 | /* iMac 9,1 */ |
| 8200 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8201 | /* Internal Speaker Pin (0x0c) */ |
| 8202 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8203 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8204 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8205 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8206 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8207 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8208 | /* HP Pin: Rear */ |
| 8209 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8210 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8211 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8212 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8213 | /* Line in Rear */ |
| 8214 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8215 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8216 | /* Front Mic pin: input vref at 80% */ |
| 8217 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8218 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8219 | /* Rear mixer */ |
| 8220 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8221 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8222 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8223 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8224 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8225 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8226 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8227 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8228 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8229 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8230 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8231 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8232 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8233 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8234 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8235 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8236 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8237 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8238 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8239 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8240 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8241 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8242 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8243 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8244 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8245 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8246 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8247 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8248 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8249 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8250 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8251 | { } |
| 8252 | }; |
| 8253 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8254 | /* iMac 24 mixer. */ |
| 8255 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8256 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8257 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8258 | { } /* end */ |
| 8259 | }; |
| 8260 | |
| 8261 | /* iMac 24 init verbs. */ |
| 8262 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8263 | /* Internal speakers: output 0 (0x0c) */ |
| 8264 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8265 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8266 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8267 | /* Internal speakers: output 0 (0x0c) */ |
| 8268 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8269 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8270 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8271 | /* Headphone: output 0 (0x0c) */ |
| 8272 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8273 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8274 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8275 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8276 | /* Front Mic: input vref at 80% */ |
| 8277 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8278 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8279 | { } |
| 8280 | }; |
| 8281 | |
| 8282 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8283 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8284 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8285 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8286 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8287 | spec->autocfg.hp_pins[0] = 0x14; |
| 8288 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8289 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8290 | } |
| 8291 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8292 | #define alc885_mb5_setup alc885_imac24_setup |
| 8293 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8294 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8295 | /* Macbook Air 2,1 */ |
| 8296 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8297 | { |
| 8298 | struct alc_spec *spec = codec->spec; |
| 8299 | |
| 8300 | spec->autocfg.hp_pins[0] = 0x14; |
| 8301 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8302 | } |
| 8303 | |
| 8304 | |
| 8305 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8306 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8307 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8308 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8309 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8310 | spec->autocfg.hp_pins[0] = 0x15; |
| 8311 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8312 | } |
| 8313 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8314 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8315 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8316 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8317 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8318 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8319 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8320 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8321 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8322 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8323 | static struct hda_verb alc882_targa_verbs[] = { |
| 8324 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8325 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8326 | |
| 8327 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8328 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8329 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8330 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8331 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8332 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8333 | |
| 8334 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8335 | { } /* end */ |
| 8336 | }; |
| 8337 | |
| 8338 | /* toggle speaker-output according to the hp-jack state */ |
| 8339 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8340 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8341 | struct alc_spec *spec = codec->spec; |
| 8342 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8343 | 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] | 8344 | spec->jack_present ? 1 : 3); |
| 8345 | } |
| 8346 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8347 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8348 | { |
| 8349 | struct alc_spec *spec = codec->spec; |
| 8350 | |
| 8351 | spec->autocfg.hp_pins[0] = 0x14; |
| 8352 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8353 | } |
| 8354 | |
| 8355 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8356 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8357 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8358 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8359 | } |
| 8360 | |
| 8361 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8362 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8363 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8364 | |
| 8365 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8366 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8367 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8368 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8369 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8370 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8371 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8372 | |
| 8373 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8374 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8375 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8376 | { } /* end */ |
| 8377 | }; |
| 8378 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8379 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8380 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8381 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8382 | |
| 8383 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8384 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8385 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8386 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8387 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8388 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8389 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8390 | |
| 8391 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8392 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8393 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8394 | { } /* end */ |
| 8395 | }; |
| 8396 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8397 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8398 | { |
| 8399 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8400 | |
| 8401 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8402 | AC_VERB_GET_GPIO_DATA, 0); |
| 8403 | |
| 8404 | if (!muted) |
| 8405 | gpiostate |= (1 << pin); |
| 8406 | else |
| 8407 | gpiostate &= ~(1 << pin); |
| 8408 | |
| 8409 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8410 | AC_VERB_GET_GPIO_MASK, 0); |
| 8411 | gpiomask |= (1 << pin); |
| 8412 | |
| 8413 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8414 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8415 | gpiodir |= (1 << pin); |
| 8416 | |
| 8417 | |
| 8418 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8419 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8420 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8421 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8422 | |
| 8423 | msleep(1); |
| 8424 | |
| 8425 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8426 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8427 | } |
| 8428 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8429 | /* set up GPIO at initialization */ |
| 8430 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8431 | { |
| 8432 | alc882_gpio_mute(codec, 0, 0); |
| 8433 | alc882_gpio_mute(codec, 1, 0); |
| 8434 | } |
| 8435 | |
| 8436 | /* set up GPIO and update auto-muting at initialization */ |
| 8437 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8438 | { |
| 8439 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8440 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8441 | } |
| 8442 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8443 | /* |
| 8444 | * generic initialization of ADC, input mixers and output mixers |
| 8445 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8446 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8447 | /* |
| 8448 | * Unmute ADC0-2 and set the default input to mic-in |
| 8449 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8450 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8451 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8452 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8453 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8454 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8455 | /* |
| 8456 | * Set up output mixers (0x0c - 0x0f) |
| 8457 | */ |
| 8458 | /* set vol=0 to output mixers */ |
| 8459 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8460 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8461 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8462 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8463 | /* set up input amps for analog loopback */ |
| 8464 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8465 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8466 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8467 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8468 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8469 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8470 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8471 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8472 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8473 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8474 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8475 | |
| 8476 | /* FIXME: use matrix-type input source selection */ |
| 8477 | /* 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] | 8478 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8479 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8480 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8481 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8482 | { } |
| 8483 | }; |
| 8484 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8485 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8486 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8487 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8488 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8489 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8490 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8491 | { } /* end */ |
| 8492 | }; |
| 8493 | |
| 8494 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8495 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8496 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8497 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8498 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8499 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8500 | { } /* end */ |
| 8501 | }; |
| 8502 | |
| 8503 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8504 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8505 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8506 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8507 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8508 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8509 | { } /* end */ |
| 8510 | }; |
| 8511 | |
| 8512 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8513 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8514 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8515 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8516 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8517 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8518 | { } /* end */ |
| 8519 | }; |
| 8520 | |
| 8521 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8522 | { 2, alc889A_mb31_ch2_init }, |
| 8523 | { 4, alc889A_mb31_ch4_init }, |
| 8524 | { 5, alc889A_mb31_ch5_init }, |
| 8525 | { 6, alc889A_mb31_ch6_init }, |
| 8526 | }; |
| 8527 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8528 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8529 | /* eanable EAPD on medion laptop */ |
| 8530 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8531 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8532 | { } |
| 8533 | }; |
| 8534 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8535 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8536 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8537 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8538 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8539 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8540 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8541 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8542 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8543 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8544 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8545 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8546 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8547 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8548 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8549 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8550 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8551 | { } /* end */ |
| 8552 | }; |
| 8553 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8554 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8555 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8556 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8557 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8558 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8559 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8560 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8561 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8562 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8563 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8564 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8565 | { } /* end */ |
| 8566 | }; |
| 8567 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8568 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8569 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8570 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8571 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8572 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8573 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8574 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8575 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8576 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8577 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8578 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8579 | { } /* end */ |
| 8580 | }; |
| 8581 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8582 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8583 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8584 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8585 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8586 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8587 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8588 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8589 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8590 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8591 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8592 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8593 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8594 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8595 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8596 | { } /* end */ |
| 8597 | }; |
| 8598 | |
| 8599 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8600 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8601 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8602 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8603 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8604 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8605 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8606 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8607 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8608 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8609 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8610 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8611 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8612 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8613 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8614 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8615 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8616 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8617 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8618 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8619 | { } /* end */ |
| 8620 | }; |
| 8621 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8622 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8623 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8624 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8625 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8626 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8627 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8628 | HDA_OUTPUT), |
| 8629 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8630 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8631 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8632 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8633 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8634 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 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, 0x1, HDA_INPUT), |
| 8638 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8639 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8640 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8641 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8642 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8643 | { } /* end */ |
| 8644 | }; |
| 8645 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8646 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8647 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8648 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8649 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8650 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8651 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8652 | HDA_OUTPUT), |
| 8653 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8654 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8655 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8656 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8657 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8658 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8659 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8660 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8661 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 8662 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 8663 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8664 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8665 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8666 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8667 | { } /* end */ |
| 8668 | }; |
| 8669 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8670 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8671 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8672 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8673 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8674 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8675 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8676 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8677 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8678 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8679 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8680 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8681 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8682 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8683 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8684 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8685 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8686 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8687 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8688 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8689 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8690 | { } /* end */ |
| 8691 | }; |
| 8692 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8693 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8694 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8695 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8696 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8697 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8698 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8699 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8700 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8701 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8702 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8703 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8704 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8705 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8706 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8707 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8708 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8709 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8710 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8711 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8712 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8713 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8714 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8715 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8716 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8717 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8718 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8719 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8720 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8721 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8722 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8723 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8724 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8725 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8726 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8727 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8728 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8729 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8730 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 8731 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8732 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8733 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8734 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8735 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8736 | { } /* end */ |
| 8737 | }; |
| 8738 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8739 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8740 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8741 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8742 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8743 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8744 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8745 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8746 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8747 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8748 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8749 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8750 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8751 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8752 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8753 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8754 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8755 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8756 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8757 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8758 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 150b432 | 2010-07-29 14:46:42 +0200 | [diff] [blame] | 8759 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8760 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8761 | { } /* end */ |
| 8762 | }; |
| 8763 | |
| 8764 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8765 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8766 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8767 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8768 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8769 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8770 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8771 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8772 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8773 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8774 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8775 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8776 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 8777 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 8778 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8779 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8780 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8781 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 8782 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 8783 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 8784 | { } /* end */ |
| 8785 | }; |
| 8786 | |
| 8787 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 8788 | /* Unmute front mixer */ |
| 8789 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8790 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8791 | |
| 8792 | /* Set speaker pin to front mixer */ |
| 8793 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8794 | |
| 8795 | /* Init headphone pin */ |
| 8796 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8797 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8798 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8799 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8800 | |
| 8801 | { } /* end */ |
| 8802 | }; |
| 8803 | |
| 8804 | /* toggle speaker-output according to the hp-jack state */ |
| 8805 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 8806 | { |
| 8807 | struct alc_spec *spec = codec->spec; |
| 8808 | |
| 8809 | spec->autocfg.hp_pins[0] = 0x1a; |
| 8810 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8811 | } |
| 8812 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8813 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8814 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8815 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8816 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8817 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8818 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8819 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8820 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8821 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8822 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8823 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8824 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8825 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8826 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8827 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 8828 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8829 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8830 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8831 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8832 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8833 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8834 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8835 | { } /* end */ |
| 8836 | }; |
| 8837 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8838 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8839 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8840 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8841 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8842 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8843 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8844 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8845 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8846 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8847 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8848 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8849 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8850 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8851 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8852 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8853 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8854 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8855 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8856 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8857 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8858 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8859 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8860 | { } /* end */ |
| 8861 | }; |
| 8862 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8863 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8864 | /* Output mixers */ |
| 8865 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8866 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8867 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8868 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8869 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8870 | HDA_OUTPUT), |
| 8871 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8872 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8873 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8874 | /* Output switches */ |
| 8875 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8876 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8877 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8878 | /* Boost mixers */ |
| 8879 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8880 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8881 | /* Input mixers */ |
| 8882 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8883 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8884 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8885 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8886 | { } /* end */ |
| 8887 | }; |
| 8888 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8889 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8890 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8891 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8892 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8893 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8894 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8895 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8896 | { } /* end */ |
| 8897 | }; |
| 8898 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8899 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8900 | .ops = &snd_hda_bind_vol, |
| 8901 | .values = { |
| 8902 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8903 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8904 | 0 |
| 8905 | }, |
| 8906 | }; |
| 8907 | |
| 8908 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8909 | .ops = &snd_hda_bind_sw, |
| 8910 | .values = { |
| 8911 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8912 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8913 | 0 |
| 8914 | }, |
| 8915 | }; |
| 8916 | |
| 8917 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8918 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8919 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8920 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8921 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8922 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8923 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8924 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8925 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8926 | { } /* end */ |
| 8927 | }; |
| 8928 | |
| 8929 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8930 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8931 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8932 | { |
| 8933 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8934 | /* .name = "Capture Source", */ |
| 8935 | .name = "Input Source", |
| 8936 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8937 | .info = alc_mux_enum_info, |
| 8938 | .get = alc_mux_enum_get, |
| 8939 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8940 | }, |
| 8941 | { } /* end */ |
| 8942 | }; |
| 8943 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8944 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8945 | { |
| 8946 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8947 | .name = "Channel Mode", |
| 8948 | .info = alc_ch_mode_info, |
| 8949 | .get = alc_ch_mode_get, |
| 8950 | .put = alc_ch_mode_put, |
| 8951 | }, |
| 8952 | { } /* end */ |
| 8953 | }; |
| 8954 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8955 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8956 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8957 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8958 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8959 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8960 | spec->autocfg.hp_pins[0] = 0x15; |
| 8961 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8962 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8963 | } |
| 8964 | |
| 8965 | /* auto-toggle front mic */ |
| 8966 | /* |
| 8967 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8968 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8969 | 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] | 8970 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8971 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8972 | } |
| 8973 | */ |
| 8974 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8975 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8976 | /* HP */ |
| 8977 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8978 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8979 | /* Subwoofer */ |
| 8980 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8981 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8982 | |
| 8983 | /* enable unsolicited event */ |
| 8984 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8985 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8986 | |
| 8987 | { } /* end */ |
| 8988 | }; |
| 8989 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8990 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 8991 | /* HP */ |
| 8992 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8993 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8994 | /* Int speaker */ |
| 8995 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 8996 | |
| 8997 | /* enable unsolicited event */ |
| 8998 | /* |
| 8999 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9000 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9001 | */ |
| 9002 | |
| 9003 | { } /* end */ |
| 9004 | }; |
| 9005 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9006 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9007 | /* HP */ |
| 9008 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9009 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9010 | /* Int speaker */ |
| 9011 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9012 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9013 | |
| 9014 | /* enable unsolicited event */ |
| 9015 | {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] | 9016 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9017 | |
| 9018 | { } /* end */ |
| 9019 | }; |
| 9020 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9021 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 9022 | /* HP */ |
| 9023 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9024 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9025 | /* Subwoofer */ |
| 9026 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9027 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9028 | |
| 9029 | /* enable unsolicited event */ |
| 9030 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9031 | |
| 9032 | { } /* end */ |
| 9033 | }; |
| 9034 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9035 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9036 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9037 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9038 | |
| 9039 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9040 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9041 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9042 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9043 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9044 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9045 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9046 | /* Connect Mic jack to CLFE */ |
| 9047 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9048 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9049 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9050 | /* Connect Line-in jack to Surround */ |
| 9051 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9052 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9053 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9054 | /* Connect HP out jack to Front */ |
| 9055 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9056 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9057 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9058 | |
| 9059 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9060 | |
| 9061 | { } /* end */ |
| 9062 | }; |
| 9063 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9064 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 9065 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9066 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9067 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9068 | { } /* end */ |
| 9069 | }; |
| 9070 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9071 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 9072 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9073 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9074 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9075 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9076 | { } /* end */ |
| 9077 | }; |
| 9078 | |
| 9079 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 9080 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9081 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9082 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9083 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9084 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9085 | { } /* end */ |
| 9086 | }; |
| 9087 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9088 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 9089 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9090 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9091 | |
| 9092 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9093 | |
| 9094 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9095 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9096 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9097 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9098 | { } /* end */ |
| 9099 | }; |
| 9100 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9101 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9102 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9103 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9104 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9105 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9106 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9107 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9108 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9109 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9110 | { } /* end */ |
| 9111 | }; |
| 9112 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9113 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9114 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9115 | { } |
| 9116 | }; |
| 9117 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9118 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9119 | /* HP */ |
| 9120 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9121 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9122 | |
| 9123 | /* enable unsolicited event */ |
| 9124 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9125 | |
| 9126 | { } /* end */ |
| 9127 | }; |
| 9128 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9129 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9130 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9131 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9132 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9133 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9134 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9135 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9136 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9137 | } |
| 9138 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9139 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9140 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9141 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9142 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9143 | {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] | 9144 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9145 | }; |
| 9146 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9147 | /* |
| 9148 | * 2ch mode |
| 9149 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9150 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9151 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9152 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9153 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9154 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9155 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9156 | }; |
| 9157 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9158 | /* |
| 9159 | * 4ch mode |
| 9160 | */ |
| 9161 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9162 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9163 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9164 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9165 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9166 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9167 | { } /* end */ |
| 9168 | }; |
| 9169 | |
| 9170 | /* |
| 9171 | * 6ch mode |
| 9172 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9173 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9174 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9175 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9176 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9177 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9178 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9179 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9180 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9181 | }; |
| 9182 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9183 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9184 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9185 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9186 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9187 | }; |
| 9188 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9189 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 9190 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 9191 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9192 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9193 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9194 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9195 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9196 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9197 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9198 | } |
| 9199 | |
| 9200 | /* toggle RCA according to the front-jack state */ |
| 9201 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 9202 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9203 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9204 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9205 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9206 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9207 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9208 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9209 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 9210 | unsigned int res) |
| 9211 | { |
| 9212 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9213 | alc888_lenovo_ms7195_front_automute(codec); |
| 9214 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9215 | alc888_lenovo_ms7195_rca_automute(codec); |
| 9216 | } |
| 9217 | |
| 9218 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 9219 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9220 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9221 | |
| 9222 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9223 | |
| 9224 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9225 | { } /* end */ |
| 9226 | }; |
| 9227 | |
| 9228 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9229 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9230 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9231 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9232 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9233 | spec->autocfg.hp_pins[0] = 0x14; |
| 9234 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9235 | } |
| 9236 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9237 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9238 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9239 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9240 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9241 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 9242 | { |
| 9243 | unsigned int present; |
| 9244 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 9245 | present = snd_hda_jack_detect(codec, 0x18); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9246 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 9247 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9248 | } |
| 9249 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9250 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9251 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9252 | struct alc_spec *spec = codec->spec; |
| 9253 | |
| 9254 | spec->autocfg.hp_pins[0] = 0x15; |
| 9255 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9256 | } |
| 9257 | |
| 9258 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9259 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9260 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9261 | alc883_clevo_m720_mic_automute(codec); |
| 9262 | } |
| 9263 | |
| 9264 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9265 | unsigned int res) |
| 9266 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9267 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9268 | case ALC880_MIC_EVENT: |
| 9269 | alc883_clevo_m720_mic_automute(codec); |
| 9270 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9271 | default: |
| 9272 | alc_automute_amp_unsol_event(codec, res); |
| 9273 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9274 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9275 | } |
| 9276 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9277 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9278 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9279 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9280 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9281 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9282 | spec->autocfg.hp_pins[0] = 0x14; |
| 9283 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9284 | } |
| 9285 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9286 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9287 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9288 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9289 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9290 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9291 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9292 | } |
| 9293 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9294 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9295 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9296 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9297 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9298 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9299 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9300 | } |
| 9301 | |
| 9302 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9303 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9304 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9305 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9306 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9307 | HDA_AMP_MUTE, bits); |
| 9308 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9309 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9310 | } |
| 9311 | |
| 9312 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9313 | unsigned int res) |
| 9314 | { |
| 9315 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9316 | alc883_lenovo_101e_all_automute(codec); |
| 9317 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9318 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9319 | } |
| 9320 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9321 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9322 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9323 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9324 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9325 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9326 | spec->autocfg.hp_pins[0] = 0x14; |
| 9327 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9328 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9329 | } |
| 9330 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9331 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9332 | /* HP Pin: output 0 (0x0c) */ |
| 9333 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9334 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9335 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9336 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9337 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9338 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9339 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9340 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9341 | /* eanable EAPD on medion laptop */ |
| 9342 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9343 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9344 | /* enable unsolicited event */ |
| 9345 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9346 | { } |
| 9347 | }; |
| 9348 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9349 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 9350 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9351 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9352 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9353 | { } /* end */ |
| 9354 | }; |
| 9355 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9356 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9357 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9358 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9359 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9360 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9361 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9362 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9363 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9364 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9365 | } |
| 9366 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9367 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9368 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9369 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9370 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9371 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9372 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9373 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9374 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9375 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9376 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9377 | } |
| 9378 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9379 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9380 | { |
| 9381 | struct alc_spec *spec = codec->spec; |
| 9382 | |
| 9383 | spec->autocfg.hp_pins[0] = 0x15; |
| 9384 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9385 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9386 | } |
| 9387 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9388 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9389 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9390 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9391 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9392 | /* enable unsolicited event */ |
| 9393 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9394 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9395 | { } /* end */ |
| 9396 | }; |
| 9397 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9398 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9399 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9400 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9401 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9402 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9403 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9404 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9405 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9406 | spec->ext_mic.pin = 0x18; |
| 9407 | spec->int_mic.pin = 0x19; |
| 9408 | spec->ext_mic.mux_idx = 0; |
| 9409 | spec->int_mic.mux_idx = 1; |
| 9410 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9411 | } |
| 9412 | |
| 9413 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9414 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9415 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9416 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9417 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9418 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9419 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9420 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9421 | /* enable unsolicited event */ |
| 9422 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9423 | { } /* end */ |
| 9424 | }; |
| 9425 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9426 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9427 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9428 | struct alc_spec *spec = codec->spec; |
| 9429 | |
| 9430 | spec->autocfg.hp_pins[0] = 0x14; |
| 9431 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9432 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9433 | } |
| 9434 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9435 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9436 | /* Init rear pin (used as headphone output) */ |
| 9437 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9438 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9439 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9440 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9441 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9442 | /* Init line 2 pin (used as headphone out by default) */ |
| 9443 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9444 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9445 | { } /* end */ |
| 9446 | }; |
| 9447 | |
| 9448 | /* Mute speakers according to the headphone jack state */ |
| 9449 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9450 | { |
| 9451 | unsigned int present; |
| 9452 | |
| 9453 | /* Mute only in 2ch or 4ch mode */ |
| 9454 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9455 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9456 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9457 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9458 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9459 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9460 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9461 | } |
| 9462 | } |
| 9463 | |
| 9464 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9465 | { |
| 9466 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9467 | alc889A_mb31_automute(codec); |
| 9468 | } |
| 9469 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9470 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9471 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9472 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9473 | #endif |
| 9474 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9475 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9476 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9477 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9478 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9479 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9480 | |
| 9481 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9482 | ALC1200_DIGOUT_NID, 0, |
| 9483 | }; |
| 9484 | |
| 9485 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9486 | ALC883_DIGOUT_NID, 0, |
| 9487 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9488 | |
| 9489 | /* |
| 9490 | * configuration and preset |
| 9491 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9492 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 9493 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9494 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9495 | [ALC882_ARIMA] = "arima", |
| 9496 | [ALC882_W2JC] = "w2jc", |
| 9497 | [ALC882_TARGA] = "targa", |
| 9498 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9499 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9500 | [ALC885_MACPRO] = "macpro", |
| 9501 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9502 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9503 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9504 | [ALC885_MBP3] = "mbp3", |
| 9505 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9506 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9507 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9508 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9509 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9510 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9511 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9512 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9513 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9514 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9515 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9516 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9517 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9518 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9519 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9520 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9521 | [ALC883_MEDION_MD2] = "medion-md2", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9522 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9523 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9524 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9525 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9526 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9527 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9528 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9529 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9530 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9531 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9532 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9533 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9534 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9535 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9536 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9537 | [ALC889A_INTEL] = "intel-alc889a", |
| 9538 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9539 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9540 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9541 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9542 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9543 | }; |
| 9544 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9545 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9546 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9547 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9548 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9549 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9550 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9551 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9552 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9553 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9554 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9555 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9556 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9557 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9558 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9559 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9560 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9561 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9562 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9563 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9564 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9565 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9566 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9567 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9568 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9569 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9570 | /* default Acer -- disabled as it causes more problems. |
| 9571 | * model=auto should work fine now |
| 9572 | */ |
| 9573 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9574 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9575 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9576 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9577 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9578 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9579 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9580 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9581 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9582 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9583 | |
| 9584 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9585 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9586 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9587 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9588 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9589 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9590 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9591 | 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] | 9592 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9593 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9594 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9595 | |
| 9596 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9597 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9598 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9599 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9600 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9601 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9602 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9603 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9604 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9605 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9606 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9607 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9608 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9609 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9610 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9611 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9612 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9613 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9614 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9615 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9616 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9617 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9618 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9619 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9620 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9621 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9622 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9623 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9624 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9625 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9626 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9627 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9628 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9629 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9630 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9631 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9632 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9633 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9634 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9635 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9636 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9637 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9638 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9639 | SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9640 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9641 | 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] | 9642 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9643 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9644 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9645 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9646 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9647 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9648 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9649 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9650 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9651 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9652 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9653 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9654 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9655 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9656 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9657 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9658 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9659 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9660 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9661 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9662 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9663 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9664 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9665 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9666 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9667 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9668 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9669 | {} |
| 9670 | }; |
| 9671 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9672 | /* codec SSID table for Intel Mac */ |
| 9673 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9674 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9675 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9676 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9677 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9678 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9679 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9680 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 9681 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 9682 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M), |
Justin P. Mattock | f53dae2 | 2010-06-06 16:09:51 -0700 | [diff] [blame] | 9683 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 9684 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9685 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9686 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9687 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9688 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9689 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 9690 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9691 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9692 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9693 | */ |
| 9694 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9695 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9696 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9697 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9698 | }; |
| 9699 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9700 | static struct alc_config_preset alc882_presets[] = { |
| 9701 | [ALC882_3ST_DIG] = { |
| 9702 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9703 | .init_verbs = { alc882_base_init_verbs, |
| 9704 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9705 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9706 | .dac_nids = alc882_dac_nids, |
| 9707 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9708 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9709 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9710 | .channel_mode = alc882_ch_modes, |
| 9711 | .need_dac_fix = 1, |
| 9712 | .input_mux = &alc882_capture_source, |
| 9713 | }, |
| 9714 | [ALC882_6ST_DIG] = { |
| 9715 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9716 | .init_verbs = { alc882_base_init_verbs, |
| 9717 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9718 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9719 | .dac_nids = alc882_dac_nids, |
| 9720 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9721 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9722 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9723 | .channel_mode = alc882_sixstack_modes, |
| 9724 | .input_mux = &alc882_capture_source, |
| 9725 | }, |
| 9726 | [ALC882_ARIMA] = { |
| 9727 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9728 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9729 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9730 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9731 | .dac_nids = alc882_dac_nids, |
| 9732 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9733 | .channel_mode = alc882_sixstack_modes, |
| 9734 | .input_mux = &alc882_capture_source, |
| 9735 | }, |
| 9736 | [ALC882_W2JC] = { |
| 9737 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9738 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9739 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9740 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9741 | .dac_nids = alc882_dac_nids, |
| 9742 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9743 | .channel_mode = alc880_threestack_modes, |
| 9744 | .need_dac_fix = 1, |
| 9745 | .input_mux = &alc882_capture_source, |
| 9746 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9747 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9748 | [ALC885_MBA21] = { |
| 9749 | .mixers = { alc885_mba21_mixer }, |
| 9750 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 9751 | .num_dacs = 2, |
| 9752 | .dac_nids = alc882_dac_nids, |
| 9753 | .channel_mode = alc885_mba21_ch_modes, |
| 9754 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9755 | .input_mux = &alc882_capture_source, |
| 9756 | .unsol_event = alc_automute_amp_unsol_event, |
| 9757 | .setup = alc885_mba21_setup, |
| 9758 | .init_hook = alc_automute_amp, |
| 9759 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9760 | [ALC885_MBP3] = { |
| 9761 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 9762 | .init_verbs = { alc885_mbp3_init_verbs, |
| 9763 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9764 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9765 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9766 | .hp_nid = 0x04, |
| 9767 | .channel_mode = alc885_mbp_4ch_modes, |
| 9768 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9769 | .input_mux = &alc882_capture_source, |
| 9770 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9771 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9772 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9773 | .setup = alc885_mbp3_setup, |
| 9774 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9775 | }, |
| 9776 | [ALC885_MB5] = { |
| 9777 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 9778 | .init_verbs = { alc885_mb5_init_verbs, |
| 9779 | alc880_gpio1_init_verbs }, |
| 9780 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9781 | .dac_nids = alc882_dac_nids, |
| 9782 | .channel_mode = alc885_mb5_6ch_modes, |
| 9783 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 9784 | .input_mux = &mb5_capture_source, |
| 9785 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9786 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9787 | .unsol_event = alc_automute_amp_unsol_event, |
| 9788 | .setup = alc885_mb5_setup, |
| 9789 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9790 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9791 | [ALC885_MACMINI3] = { |
| 9792 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 9793 | .init_verbs = { alc885_macmini3_init_verbs, |
| 9794 | alc880_gpio1_init_verbs }, |
| 9795 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9796 | .dac_nids = alc882_dac_nids, |
| 9797 | .channel_mode = alc885_macmini3_6ch_modes, |
| 9798 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 9799 | .input_mux = &macmini3_capture_source, |
| 9800 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9801 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9802 | .unsol_event = alc_automute_amp_unsol_event, |
| 9803 | .setup = alc885_macmini3_setup, |
| 9804 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9805 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9806 | [ALC885_MACPRO] = { |
| 9807 | .mixers = { alc882_macpro_mixer }, |
| 9808 | .init_verbs = { alc882_macpro_init_verbs }, |
| 9809 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9810 | .dac_nids = alc882_dac_nids, |
| 9811 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9812 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9813 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9814 | .channel_mode = alc882_ch_modes, |
| 9815 | .input_mux = &alc882_capture_source, |
| 9816 | .init_hook = alc885_macpro_init_hook, |
| 9817 | }, |
| 9818 | [ALC885_IMAC24] = { |
| 9819 | .mixers = { alc885_imac24_mixer }, |
| 9820 | .init_verbs = { alc885_imac24_init_verbs }, |
| 9821 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9822 | .dac_nids = alc882_dac_nids, |
| 9823 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9824 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9825 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9826 | .channel_mode = alc882_ch_modes, |
| 9827 | .input_mux = &alc882_capture_source, |
| 9828 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9829 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9830 | .init_hook = alc885_imac24_init_hook, |
| 9831 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9832 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 9833 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9834 | .init_verbs = { alc885_imac91_init_verbs, |
| 9835 | alc880_gpio1_init_verbs }, |
| 9836 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9837 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 9838 | .channel_mode = alc885_mba21_ch_modes, |
| 9839 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9840 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9841 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9842 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9843 | .unsol_event = alc_automute_amp_unsol_event, |
| 9844 | .setup = alc885_imac91_setup, |
| 9845 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9846 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9847 | [ALC882_TARGA] = { |
| 9848 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9849 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 9850 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9851 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9852 | .dac_nids = alc882_dac_nids, |
| 9853 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9854 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9855 | .adc_nids = alc882_adc_nids, |
| 9856 | .capsrc_nids = alc882_capsrc_nids, |
| 9857 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9858 | .channel_mode = alc882_3ST_6ch_modes, |
| 9859 | .need_dac_fix = 1, |
| 9860 | .input_mux = &alc882_capture_source, |
| 9861 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9862 | .setup = alc882_targa_setup, |
| 9863 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9864 | }, |
| 9865 | [ALC882_ASUS_A7J] = { |
| 9866 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9867 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9868 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9869 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9870 | .dac_nids = alc882_dac_nids, |
| 9871 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9872 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9873 | .adc_nids = alc882_adc_nids, |
| 9874 | .capsrc_nids = alc882_capsrc_nids, |
| 9875 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9876 | .channel_mode = alc882_3ST_6ch_modes, |
| 9877 | .need_dac_fix = 1, |
| 9878 | .input_mux = &alc882_capture_source, |
| 9879 | }, |
| 9880 | [ALC882_ASUS_A7M] = { |
| 9881 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9882 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9883 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9884 | alc882_asus_a7m_verbs }, |
| 9885 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9886 | .dac_nids = alc882_dac_nids, |
| 9887 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9888 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9889 | .channel_mode = alc880_threestack_modes, |
| 9890 | .need_dac_fix = 1, |
| 9891 | .input_mux = &alc882_capture_source, |
| 9892 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9893 | [ALC883_3ST_2ch_DIG] = { |
| 9894 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9895 | .init_verbs = { alc883_init_verbs }, |
| 9896 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9897 | .dac_nids = alc883_dac_nids, |
| 9898 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9899 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9900 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9901 | .channel_mode = alc883_3ST_2ch_modes, |
| 9902 | .input_mux = &alc883_capture_source, |
| 9903 | }, |
| 9904 | [ALC883_3ST_6ch_DIG] = { |
| 9905 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9906 | .init_verbs = { alc883_init_verbs }, |
| 9907 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9908 | .dac_nids = alc883_dac_nids, |
| 9909 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9910 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9911 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9912 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9913 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9914 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9915 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9916 | [ALC883_3ST_6ch] = { |
| 9917 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9918 | .init_verbs = { alc883_init_verbs }, |
| 9919 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9920 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9921 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9922 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9923 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9924 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9925 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9926 | [ALC883_3ST_6ch_INTEL] = { |
| 9927 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9928 | .init_verbs = { alc883_init_verbs }, |
| 9929 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9930 | .dac_nids = alc883_dac_nids, |
| 9931 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9932 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9933 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9934 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9935 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9936 | .need_dac_fix = 1, |
| 9937 | .input_mux = &alc883_3stack_6ch_intel, |
| 9938 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9939 | [ALC889A_INTEL] = { |
| 9940 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9941 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 9942 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9943 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9944 | .dac_nids = alc883_dac_nids, |
| 9945 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9946 | .adc_nids = alc889_adc_nids, |
| 9947 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9948 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9949 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9950 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9951 | .channel_mode = alc889_8ch_intel_modes, |
| 9952 | .capsrc_nids = alc889_capsrc_nids, |
| 9953 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9954 | .setup = alc889_automute_setup, |
| 9955 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9956 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9957 | .need_dac_fix = 1, |
| 9958 | }, |
| 9959 | [ALC889_INTEL] = { |
| 9960 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9961 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9962 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9963 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9964 | .dac_nids = alc883_dac_nids, |
| 9965 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9966 | .adc_nids = alc889_adc_nids, |
| 9967 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9968 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9969 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9970 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9971 | .channel_mode = alc889_8ch_intel_modes, |
| 9972 | .capsrc_nids = alc889_capsrc_nids, |
| 9973 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9974 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9975 | .init_hook = alc889_intel_init_hook, |
| 9976 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9977 | .need_dac_fix = 1, |
| 9978 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9979 | [ALC883_6ST_DIG] = { |
| 9980 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9981 | .init_verbs = { alc883_init_verbs }, |
| 9982 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9983 | .dac_nids = alc883_dac_nids, |
| 9984 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9985 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9986 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9987 | .channel_mode = alc883_sixstack_modes, |
| 9988 | .input_mux = &alc883_capture_source, |
| 9989 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9990 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9991 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9992 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9993 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9994 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9995 | .dac_nids = alc883_dac_nids, |
| 9996 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9997 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9998 | .channel_mode = alc883_3ST_6ch_modes, |
| 9999 | .need_dac_fix = 1, |
| 10000 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10001 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10002 | .setup = alc882_targa_setup, |
| 10003 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10004 | }, |
| 10005 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10006 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10007 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10008 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10009 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10010 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10011 | .adc_nids = alc883_adc_nids_alt, |
| 10012 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10013 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10014 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10015 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10016 | .channel_mode = alc883_3ST_2ch_modes, |
| 10017 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10018 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10019 | .setup = alc882_targa_setup, |
| 10020 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10021 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10022 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10023 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10024 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10025 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10026 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10027 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10028 | .dac_nids = alc883_dac_nids, |
| 10029 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10030 | .adc_nids = alc883_adc_nids_rev, |
| 10031 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10032 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10033 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10034 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10035 | .channel_mode = alc883_4ST_8ch_modes, |
| 10036 | .need_dac_fix = 1, |
| 10037 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10038 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10039 | .setup = alc882_targa_setup, |
| 10040 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10041 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10042 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10043 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10044 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10045 | * and the headphone jack. Turn this on and rely on the |
| 10046 | * standard mute methods whenever the user wants to turn |
| 10047 | * these outputs off. |
| 10048 | */ |
| 10049 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10050 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10051 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10052 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10053 | .channel_mode = alc883_3ST_2ch_modes, |
| 10054 | .input_mux = &alc883_capture_source, |
| 10055 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10056 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10057 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10058 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10059 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10060 | .dac_nids = alc883_dac_nids, |
| 10061 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10062 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10063 | .channel_mode = alc883_3ST_2ch_modes, |
| 10064 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10065 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10066 | .setup = alc883_acer_aspire_setup, |
| 10067 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10068 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10069 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10070 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10071 | alc883_chmode_mixer }, |
| 10072 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10073 | alc888_acer_aspire_4930g_verbs }, |
| 10074 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10075 | .dac_nids = alc883_dac_nids, |
| 10076 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10077 | .adc_nids = alc883_adc_nids_rev, |
| 10078 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10079 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10080 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10081 | .channel_mode = alc883_3ST_6ch_modes, |
| 10082 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10083 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10084 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10085 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10086 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10087 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10088 | .setup = alc888_acer_aspire_4930g_setup, |
| 10089 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10090 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10091 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10092 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10093 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10094 | alc888_acer_aspire_6530g_verbs }, |
| 10095 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10096 | .dac_nids = alc883_dac_nids, |
| 10097 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10098 | .adc_nids = alc883_adc_nids_rev, |
| 10099 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10100 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10101 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10102 | .channel_mode = alc883_3ST_2ch_modes, |
| 10103 | .num_mux_defs = |
| 10104 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10105 | .input_mux = alc888_acer_aspire_6530_sources, |
| 10106 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10107 | .setup = alc888_acer_aspire_6530g_setup, |
| 10108 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10109 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10110 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10111 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10112 | alc883_chmode_mixer }, |
| 10113 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10114 | alc889_acer_aspire_8930g_verbs, |
| 10115 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10116 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10117 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10118 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10119 | .adc_nids = alc889_adc_nids, |
| 10120 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10121 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10122 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10123 | .channel_mode = alc883_3ST_6ch_modes, |
| 10124 | .need_dac_fix = 1, |
| 10125 | .const_channel_count = 6, |
| 10126 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10127 | ARRAY_SIZE(alc889_capture_sources), |
| 10128 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10129 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10130 | .setup = alc889_acer_aspire_8930g_setup, |
| 10131 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10132 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10133 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10134 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10135 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10136 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10137 | .mixers = { alc883_3ST_6ch_mixer, |
| 10138 | alc883_chmode_mixer }, |
| 10139 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10140 | alc888_acer_aspire_7730G_verbs }, |
| 10141 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10142 | .dac_nids = alc883_dac_nids, |
| 10143 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10144 | .adc_nids = alc883_adc_nids_rev, |
| 10145 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10146 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10147 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10148 | .channel_mode = alc883_3ST_6ch_modes, |
| 10149 | .need_dac_fix = 1, |
| 10150 | .const_channel_count = 6, |
| 10151 | .input_mux = &alc883_capture_source, |
| 10152 | .unsol_event = alc_automute_amp_unsol_event, |
| 10153 | .setup = alc888_acer_aspire_6530g_setup, |
| 10154 | .init_hook = alc_automute_amp, |
| 10155 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10156 | [ALC883_MEDION] = { |
| 10157 | .mixers = { alc883_fivestack_mixer, |
| 10158 | alc883_chmode_mixer }, |
| 10159 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10160 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10161 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10162 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10163 | .adc_nids = alc883_adc_nids_alt, |
| 10164 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10165 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10166 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10167 | .channel_mode = alc883_sixstack_modes, |
| 10168 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10169 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10170 | [ALC883_MEDION_MD2] = { |
| 10171 | .mixers = { alc883_medion_md2_mixer}, |
| 10172 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 10173 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10174 | .dac_nids = alc883_dac_nids, |
| 10175 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10176 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10177 | .channel_mode = alc883_3ST_2ch_modes, |
| 10178 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10179 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10180 | .setup = alc883_medion_md2_setup, |
| 10181 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10182 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10183 | [ALC883_MEDION_WIM2160] = { |
| 10184 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10185 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10186 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10187 | .dac_nids = alc883_dac_nids, |
| 10188 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10189 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10190 | .adc_nids = alc883_adc_nids, |
| 10191 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10192 | .channel_mode = alc883_3ST_2ch_modes, |
| 10193 | .input_mux = &alc883_capture_source, |
| 10194 | .unsol_event = alc_automute_amp_unsol_event, |
| 10195 | .setup = alc883_medion_wim2160_setup, |
| 10196 | .init_hook = alc_automute_amp, |
| 10197 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10198 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10199 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10200 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10201 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10202 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10203 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10204 | .channel_mode = alc883_3ST_2ch_modes, |
| 10205 | .input_mux = &alc883_capture_source, |
| 10206 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10207 | [ALC883_CLEVO_M540R] = { |
| 10208 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10209 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10210 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10211 | .dac_nids = alc883_dac_nids, |
| 10212 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10213 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10214 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10215 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10216 | .need_dac_fix = 1, |
| 10217 | .input_mux = &alc883_capture_source, |
| 10218 | /* This machine has the hardware HP auto-muting, thus |
| 10219 | * we need no software mute via unsol event |
| 10220 | */ |
| 10221 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10222 | [ALC883_CLEVO_M720] = { |
| 10223 | .mixers = { alc883_clevo_m720_mixer }, |
| 10224 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10225 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10226 | .dac_nids = alc883_dac_nids, |
| 10227 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10228 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10229 | .channel_mode = alc883_3ST_2ch_modes, |
| 10230 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10231 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10232 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10233 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10234 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10235 | [ALC883_LENOVO_101E_2ch] = { |
| 10236 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10237 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10238 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10239 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10240 | .adc_nids = alc883_adc_nids_alt, |
| 10241 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10242 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10243 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10244 | .channel_mode = alc883_3ST_2ch_modes, |
| 10245 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 10246 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 10247 | .init_hook = alc883_lenovo_101e_all_automute, |
| 10248 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10249 | [ALC883_LENOVO_NB0763] = { |
| 10250 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10251 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10252 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10253 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10254 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10255 | .channel_mode = alc883_3ST_2ch_modes, |
| 10256 | .need_dac_fix = 1, |
| 10257 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10258 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10259 | .setup = alc883_medion_md2_setup, |
| 10260 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10261 | }, |
| 10262 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10263 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10264 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10265 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10266 | .dac_nids = alc883_dac_nids, |
| 10267 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10268 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10269 | .channel_mode = alc883_3ST_6ch_modes, |
| 10270 | .need_dac_fix = 1, |
| 10271 | .input_mux = &alc883_capture_source, |
| 10272 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 10273 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10274 | }, |
| 10275 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10276 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10277 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10278 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10279 | .dac_nids = alc883_dac_nids, |
| 10280 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10281 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10282 | .channel_mode = alc883_3ST_2ch_modes, |
| 10283 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10284 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10285 | .setup = alc883_haier_w66_setup, |
| 10286 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10287 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10288 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10289 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10290 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10291 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10292 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10293 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10294 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10295 | .need_dac_fix = 1, |
| 10296 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10297 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10298 | .setup = alc888_3st_hp_setup, |
| 10299 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10300 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10301 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10302 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10303 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10304 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10305 | .dac_nids = alc883_dac_nids, |
| 10306 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10307 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10308 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10309 | .channel_mode = alc883_sixstack_modes, |
| 10310 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10311 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10312 | .setup = alc888_6st_dell_setup, |
| 10313 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10314 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10315 | [ALC883_MITAC] = { |
| 10316 | .mixers = { alc883_mitac_mixer }, |
| 10317 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10318 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10319 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10320 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10321 | .channel_mode = alc883_3ST_2ch_modes, |
| 10322 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10323 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10324 | .setup = alc883_mitac_setup, |
| 10325 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10326 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10327 | [ALC883_FUJITSU_PI2515] = { |
| 10328 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10329 | .init_verbs = { alc883_init_verbs, |
| 10330 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10331 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10332 | .dac_nids = alc883_dac_nids, |
| 10333 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10334 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10335 | .channel_mode = alc883_3ST_2ch_modes, |
| 10336 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10337 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10338 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10339 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10340 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10341 | [ALC888_FUJITSU_XA3530] = { |
| 10342 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10343 | .init_verbs = { alc883_init_verbs, |
| 10344 | alc888_fujitsu_xa3530_verbs }, |
| 10345 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10346 | .dac_nids = alc883_dac_nids, |
| 10347 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10348 | .adc_nids = alc883_adc_nids_rev, |
| 10349 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10350 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10351 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10352 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10353 | .num_mux_defs = |
| 10354 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10355 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10356 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10357 | .setup = alc888_fujitsu_xa3530_setup, |
| 10358 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10359 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10360 | [ALC888_LENOVO_SKY] = { |
| 10361 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10362 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10363 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10364 | .dac_nids = alc883_dac_nids, |
| 10365 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10366 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10367 | .channel_mode = alc883_sixstack_modes, |
| 10368 | .need_dac_fix = 1, |
| 10369 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10370 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10371 | .setup = alc888_lenovo_sky_setup, |
| 10372 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10373 | }, |
| 10374 | [ALC888_ASUS_M90V] = { |
| 10375 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10376 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10377 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10378 | .dac_nids = alc883_dac_nids, |
| 10379 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10380 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10381 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10382 | .channel_mode = alc883_3ST_6ch_modes, |
| 10383 | .need_dac_fix = 1, |
| 10384 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10385 | .unsol_event = alc_sku_unsol_event, |
| 10386 | .setup = alc883_mode2_setup, |
| 10387 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10388 | }, |
| 10389 | [ALC888_ASUS_EEE1601] = { |
| 10390 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10391 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10392 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10393 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10394 | .dac_nids = alc883_dac_nids, |
| 10395 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10396 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10397 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10398 | .channel_mode = alc883_3ST_2ch_modes, |
| 10399 | .need_dac_fix = 1, |
| 10400 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10401 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10402 | .init_hook = alc883_eee1601_inithook, |
| 10403 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10404 | [ALC1200_ASUS_P5Q] = { |
| 10405 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10406 | .init_verbs = { alc883_init_verbs }, |
| 10407 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10408 | .dac_nids = alc883_dac_nids, |
| 10409 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10410 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10411 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10412 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10413 | .channel_mode = alc883_sixstack_modes, |
| 10414 | .input_mux = &alc883_capture_source, |
| 10415 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10416 | [ALC889A_MB31] = { |
| 10417 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10418 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10419 | alc880_gpio1_init_verbs }, |
| 10420 | .adc_nids = alc883_adc_nids, |
| 10421 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10422 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10423 | .dac_nids = alc883_dac_nids, |
| 10424 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10425 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10426 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10427 | .input_mux = &alc889A_mb31_capture_source, |
| 10428 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10429 | .unsol_event = alc889A_mb31_unsol_event, |
| 10430 | .init_hook = alc889A_mb31_automute, |
| 10431 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10432 | [ALC883_SONY_VAIO_TT] = { |
| 10433 | .mixers = { alc883_vaiott_mixer }, |
| 10434 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10435 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10436 | .dac_nids = alc883_dac_nids, |
| 10437 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10438 | .channel_mode = alc883_3ST_2ch_modes, |
| 10439 | .input_mux = &alc883_capture_source, |
| 10440 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10441 | .setup = alc883_vaiott_setup, |
| 10442 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10443 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10444 | }; |
| 10445 | |
| 10446 | |
| 10447 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10448 | * Pin config fixes |
| 10449 | */ |
| 10450 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10451 | PINFIX_ABIT_AW9D_MAX, |
| 10452 | PINFIX_PB_M5210, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10453 | }; |
| 10454 | |
| 10455 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 10456 | { 0x15, 0x01080104 }, /* side */ |
| 10457 | { 0x16, 0x01011012 }, /* rear */ |
| 10458 | { 0x17, 0x01016011 }, /* clfe */ |
| 10459 | { } |
| 10460 | }; |
| 10461 | |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10462 | static const struct hda_verb pb_m5210_verbs[] = { |
| 10463 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10464 | {} |
| 10465 | }; |
| 10466 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10467 | static const struct alc_fixup alc882_fixups[] = { |
| 10468 | [PINFIX_ABIT_AW9D_MAX] = { |
| 10469 | .pins = alc882_abit_aw9d_pinfix |
| 10470 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10471 | [PINFIX_PB_M5210] = { |
| 10472 | .verbs = pb_m5210_verbs |
| 10473 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10474 | }; |
| 10475 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10476 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10477 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10478 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 10479 | {} |
| 10480 | }; |
| 10481 | |
| 10482 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10483 | * BIOS auto configuration |
| 10484 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10485 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10486 | const struct auto_pin_cfg *cfg) |
| 10487 | { |
| 10488 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10489 | } |
| 10490 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10491 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10492 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10493 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10494 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10495 | int idx; |
| 10496 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10497 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10498 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10499 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10500 | if (dac == 0x25) |
| 10501 | idx = 4; |
| 10502 | else if (dac >= 0x02 && dac <= 0x05) |
| 10503 | idx = dac - 2; |
| 10504 | else |
| 10505 | return; |
| 10506 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10507 | } |
| 10508 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10509 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10510 | { |
| 10511 | struct alc_spec *spec = codec->spec; |
| 10512 | int i; |
| 10513 | |
| 10514 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10515 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10516 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10517 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10518 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10519 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10520 | } |
| 10521 | } |
| 10522 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10523 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10524 | { |
| 10525 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10526 | hda_nid_t pin, dac; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10527 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10528 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10529 | if (pin) { |
| 10530 | dac = spec->multiout.hp_nid; |
| 10531 | if (!dac) |
| 10532 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10533 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10534 | } |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10535 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10536 | if (pin) { |
| 10537 | dac = spec->multiout.extra_out_nid[0]; |
| 10538 | if (!dac) |
| 10539 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10540 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10541 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10542 | } |
| 10543 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10544 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10545 | { |
| 10546 | struct alc_spec *spec = codec->spec; |
| 10547 | int i; |
| 10548 | |
| 10549 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10550 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10551 | if (!nid) |
| 10552 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 10553 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10554 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10555 | snd_hda_codec_write(codec, nid, 0, |
| 10556 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10557 | AMP_OUT_MUTE); |
| 10558 | } |
| 10559 | } |
| 10560 | |
| 10561 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10562 | { |
| 10563 | struct alc_spec *spec = codec->spec; |
| 10564 | int c; |
| 10565 | |
| 10566 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10567 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10568 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10569 | unsigned int mux_idx; |
| 10570 | const struct hda_input_mux *imux; |
| 10571 | int conns, mute, idx, item; |
| 10572 | |
| 10573 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10574 | ARRAY_SIZE(conn_list)); |
| 10575 | if (conns < 0) |
| 10576 | continue; |
| 10577 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10578 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10579 | if (!imux->num_items && mux_idx > 0) |
| 10580 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10581 | for (idx = 0; idx < conns; idx++) { |
| 10582 | /* if the current connection is the selected one, |
| 10583 | * unmute it as default - otherwise mute it |
| 10584 | */ |
| 10585 | mute = AMP_IN_MUTE(idx); |
| 10586 | for (item = 0; item < imux->num_items; item++) { |
| 10587 | if (imux->items[item].index == idx) { |
| 10588 | if (spec->cur_mux[c] == item) |
| 10589 | mute = AMP_IN_UNMUTE(idx); |
| 10590 | break; |
| 10591 | } |
| 10592 | } |
| 10593 | /* check if we have a selector or mixer |
| 10594 | * we could check for the widget type instead, but |
| 10595 | * just check for Amp-In presence (in case of mixer |
| 10596 | * without amp-in there is something wrong, this |
| 10597 | * function shouldn't be used or capsrc nid is wrong) |
| 10598 | */ |
| 10599 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10600 | snd_hda_codec_write(codec, nid, 0, |
| 10601 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10602 | mute); |
| 10603 | else if (mute != AMP_IN_MUTE(idx)) |
| 10604 | snd_hda_codec_write(codec, nid, 0, |
| 10605 | AC_VERB_SET_CONNECT_SEL, |
| 10606 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10607 | } |
| 10608 | } |
| 10609 | } |
| 10610 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10611 | /* add mic boosts if needed */ |
| 10612 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10613 | { |
| 10614 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10615 | int err; |
| 10616 | hda_nid_t nid; |
| 10617 | |
| 10618 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 10619 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10620 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10621 | "Mic Boost", |
| 10622 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10623 | if (err < 0) |
| 10624 | return err; |
| 10625 | } |
| 10626 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 10627 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10628 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10629 | "Front Mic Boost", |
| 10630 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10631 | if (err < 0) |
| 10632 | return err; |
| 10633 | } |
| 10634 | return 0; |
| 10635 | } |
| 10636 | |
| 10637 | /* almost identical with ALC880 parser... */ |
| 10638 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10639 | { |
| 10640 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10641 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10642 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10643 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10644 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10645 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10646 | if (err < 0) |
| 10647 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10648 | if (!spec->autocfg.line_outs) |
| 10649 | return 0; /* can't find valid BIOS pin config */ |
| 10650 | |
| 10651 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10652 | if (err < 0) |
| 10653 | return err; |
| 10654 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10655 | if (err < 0) |
| 10656 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10657 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10658 | "Headphone"); |
| 10659 | if (err < 0) |
| 10660 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10661 | err = alc880_auto_create_extra_out(spec, |
| 10662 | spec->autocfg.speaker_pins[0], |
| 10663 | "Speaker"); |
| 10664 | if (err < 0) |
| 10665 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10666 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10667 | if (err < 0) |
| 10668 | return err; |
| 10669 | |
| 10670 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10671 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10672 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10673 | |
| 10674 | if (spec->kctls.list) |
| 10675 | add_mixer(spec, spec->kctls.list); |
| 10676 | |
| 10677 | add_verb(spec, alc883_auto_init_verbs); |
| 10678 | /* if ADC 0x07 is available, initialize it, too */ |
| 10679 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10680 | add_verb(spec, alc882_adc1_init_verbs); |
| 10681 | |
| 10682 | spec->num_mux_defs = 1; |
| 10683 | spec->input_mux = &spec->private_imux[0]; |
| 10684 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10685 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10686 | |
| 10687 | err = alc_auto_add_mic_boost(codec); |
| 10688 | if (err < 0) |
| 10689 | return err; |
| 10690 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10691 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10692 | } |
| 10693 | |
| 10694 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10695 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10696 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10697 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10698 | alc882_auto_init_multi_out(codec); |
| 10699 | alc882_auto_init_hp_out(codec); |
| 10700 | alc882_auto_init_analog_input(codec); |
| 10701 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10702 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10703 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10704 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10705 | } |
| 10706 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10707 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10708 | { |
| 10709 | struct alc_spec *spec; |
| 10710 | int err, board_config; |
| 10711 | |
| 10712 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10713 | if (spec == NULL) |
| 10714 | return -ENOMEM; |
| 10715 | |
| 10716 | codec->spec = spec; |
| 10717 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10718 | alc_auto_parse_customize_define(codec); |
| 10719 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10720 | switch (codec->vendor_id) { |
| 10721 | case 0x10ec0882: |
| 10722 | case 0x10ec0885: |
| 10723 | break; |
| 10724 | default: |
| 10725 | /* ALC883 and variants */ |
| 10726 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10727 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10728 | } |
| 10729 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10730 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10731 | alc882_models, |
| 10732 | alc882_cfg_tbl); |
| 10733 | |
| 10734 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10735 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10736 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10737 | |
| 10738 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10739 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10740 | codec->chip_name); |
| 10741 | board_config = ALC882_AUTO; |
| 10742 | } |
| 10743 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10744 | if (board_config == ALC882_AUTO) |
| 10745 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10746 | |
| 10747 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10748 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10749 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10750 | if (err < 0) { |
| 10751 | alc_free(codec); |
| 10752 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10753 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10754 | printk(KERN_INFO |
| 10755 | "hda_codec: Cannot set up configuration " |
| 10756 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10757 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10758 | } |
| 10759 | } |
| 10760 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 10761 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 10762 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 10763 | if (err < 0) { |
| 10764 | alc_free(codec); |
| 10765 | return err; |
| 10766 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 10767 | } |
| 10768 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10769 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 10770 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10771 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10772 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 10773 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 10774 | /* FIXME: setup DAC5 */ |
| 10775 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 10776 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 10777 | |
| 10778 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 10779 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 10780 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10781 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10782 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10783 | spec->num_adc_nids = 0; |
| 10784 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10785 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10786 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10787 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10788 | hda_nid_t nid = alc882_adc_nids[i]; |
| 10789 | unsigned int wcap = get_wcaps(codec, nid); |
| 10790 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 10791 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10792 | if (wcap != AC_WID_AUD_IN) |
| 10793 | continue; |
| 10794 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 10795 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 10796 | if (err < 0) |
| 10797 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10798 | err = snd_hda_get_connections(codec, cap, items, |
| 10799 | ARRAY_SIZE(items)); |
| 10800 | if (err < 0) |
| 10801 | continue; |
| 10802 | for (j = 0; j < imux->num_items; j++) |
| 10803 | if (imux->items[j].index >= err) |
| 10804 | break; |
| 10805 | if (j < imux->num_items) |
| 10806 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10807 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 10808 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10809 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10810 | spec->adc_nids = spec->private_adc_nids; |
| 10811 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10812 | } |
| 10813 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 10814 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10815 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 10816 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10817 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10818 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10819 | if (board_config == ALC882_AUTO) |
| 10820 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); |
| 10821 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10822 | spec->vmaster_nid = 0x0c; |
| 10823 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10824 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10825 | if (board_config == ALC882_AUTO) |
| 10826 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10827 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10828 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10829 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10830 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10831 | |
| 10832 | return 0; |
| 10833 | } |
| 10834 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10835 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10836 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10837 | * ALC262 support |
| 10838 | */ |
| 10839 | |
| 10840 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 10841 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 10842 | |
| 10843 | #define alc262_dac_nids alc260_dac_nids |
| 10844 | #define alc262_adc_nids alc882_adc_nids |
| 10845 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10846 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 10847 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10848 | |
| 10849 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 10850 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10851 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10852 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 10853 | /* ADC0 */ |
| 10854 | 0x09 |
| 10855 | }; |
| 10856 | |
| 10857 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 10858 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10859 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 10860 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10861 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10862 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10863 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10864 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10865 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10866 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10867 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10868 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10869 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10870 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10871 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10872 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 10873 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10874 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 10875 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10876 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10877 | }; |
| 10878 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10879 | /* update HP, line and mono-out pins according to the master switch */ |
| 10880 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 10881 | { |
| 10882 | struct alc_spec *spec = codec->spec; |
| 10883 | int val = spec->master_sw; |
| 10884 | |
| 10885 | /* HP & line-out */ |
| 10886 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 10887 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10888 | val ? PIN_HP : 0); |
| 10889 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10890 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10891 | val ? PIN_HP : 0); |
| 10892 | /* mono (speaker) depending on the HP jack sense */ |
| 10893 | val = val && !spec->jack_present; |
| 10894 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 10895 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10896 | val ? PIN_OUT : 0); |
| 10897 | } |
| 10898 | |
| 10899 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 10900 | { |
| 10901 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10902 | |
| 10903 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10904 | alc262_hp_master_update(codec); |
| 10905 | } |
| 10906 | |
| 10907 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10908 | { |
| 10909 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10910 | return; |
| 10911 | alc262_hp_bpc_automute(codec); |
| 10912 | } |
| 10913 | |
| 10914 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 10915 | { |
| 10916 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10917 | |
| 10918 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10919 | alc262_hp_master_update(codec); |
| 10920 | } |
| 10921 | |
| 10922 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 10923 | unsigned int res) |
| 10924 | { |
| 10925 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10926 | return; |
| 10927 | alc262_hp_wildwest_automute(codec); |
| 10928 | } |
| 10929 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10930 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10931 | |
| 10932 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10933 | struct snd_ctl_elem_value *ucontrol) |
| 10934 | { |
| 10935 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10936 | struct alc_spec *spec = codec->spec; |
| 10937 | int val = !!*ucontrol->value.integer.value; |
| 10938 | |
| 10939 | if (val == spec->master_sw) |
| 10940 | return 0; |
| 10941 | spec->master_sw = val; |
| 10942 | alc262_hp_master_update(codec); |
| 10943 | return 1; |
| 10944 | } |
| 10945 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10946 | #define ALC262_HP_MASTER_SWITCH \ |
| 10947 | { \ |
| 10948 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10949 | .name = "Master Playback Switch", \ |
| 10950 | .info = snd_ctl_boolean_mono_info, \ |
| 10951 | .get = alc262_hp_master_sw_get, \ |
| 10952 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10953 | }, \ |
| 10954 | { \ |
| 10955 | .iface = NID_MAPPING, \ |
| 10956 | .name = "Master Playback Switch", \ |
| 10957 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10958 | } |
| 10959 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10960 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10961 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10962 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10963 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10964 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10965 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10966 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10967 | HDA_OUTPUT), |
| 10968 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10969 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10970 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10971 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10972 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10973 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10974 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10975 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10976 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10977 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10978 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10979 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10980 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10981 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10982 | { } /* end */ |
| 10983 | }; |
| 10984 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10985 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10986 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10987 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10988 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10989 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10990 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10991 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10992 | HDA_OUTPUT), |
| 10993 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10994 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10995 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10996 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10997 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10998 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10999 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11000 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11001 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11002 | { } /* end */ |
| 11003 | }; |
| 11004 | |
| 11005 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 11006 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11007 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11008 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11009 | { } /* end */ |
| 11010 | }; |
| 11011 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11012 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11013 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11014 | { |
| 11015 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11016 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11017 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11018 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11019 | } |
| 11020 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11021 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11022 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11023 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11024 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11025 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11026 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11027 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11028 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11029 | { } /* end */ |
| 11030 | }; |
| 11031 | |
| 11032 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 11033 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11034 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11035 | |
| 11036 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11037 | { } |
| 11038 | }; |
| 11039 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11040 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11041 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11042 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11043 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11044 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11045 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11046 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11047 | { } /* end */ |
| 11048 | }; |
| 11049 | |
| 11050 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 11051 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11052 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11053 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11054 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11055 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11056 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11057 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11058 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11059 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11060 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11061 | {} |
| 11062 | }; |
| 11063 | |
| 11064 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 11065 | .num_items = 1, |
| 11066 | .items = { |
| 11067 | { "Line", 0x1 }, |
| 11068 | }, |
| 11069 | }; |
| 11070 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11071 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 11072 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 11073 | { |
| 11074 | struct alc_spec *spec = codec->spec; |
| 11075 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11076 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11077 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11078 | unsigned int mute; |
| 11079 | |
| 11080 | /* HP */ |
| 11081 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 11082 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 11083 | HDA_AMP_MUTE, mute); |
| 11084 | /* mute internal speaker per jack sense */ |
| 11085 | if (spec->jack_present) |
| 11086 | mute = HDA_AMP_MUTE; |
| 11087 | if (line_nid) |
| 11088 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 11089 | HDA_AMP_MUTE, mute); |
| 11090 | if (speaker_nid && speaker_nid != line_nid) |
| 11091 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 11092 | HDA_AMP_MUTE, mute); |
| 11093 | } |
| 11094 | |
| 11095 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 11096 | |
| 11097 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11098 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11099 | { |
| 11100 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11101 | struct alc_spec *spec = codec->spec; |
| 11102 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11103 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11104 | if (val == spec->master_sw) |
| 11105 | return 0; |
| 11106 | spec->master_sw = val; |
| 11107 | alc262_hippo_master_update(codec); |
| 11108 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11109 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11110 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11111 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11112 | { \ |
| 11113 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11114 | .name = "Master Playback Switch", \ |
| 11115 | .info = snd_ctl_boolean_mono_info, \ |
| 11116 | .get = alc262_hippo_master_sw_get, \ |
| 11117 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11118 | }, \ |
| 11119 | { \ |
| 11120 | .iface = NID_MAPPING, \ |
| 11121 | .name = "Master Playback Switch", \ |
| 11122 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11123 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11124 | } |
| 11125 | |
| 11126 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11127 | ALC262_HIPPO_MASTER_SWITCH, |
| 11128 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11129 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11130 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11131 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11132 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11133 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11134 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11135 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11136 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11137 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11138 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11139 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11140 | { } /* end */ |
| 11141 | }; |
| 11142 | |
| 11143 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11144 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11145 | ALC262_HIPPO_MASTER_SWITCH, |
| 11146 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11147 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11148 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11149 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11150 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11151 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11152 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11153 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11154 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11155 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11156 | { } /* end */ |
| 11157 | }; |
| 11158 | |
| 11159 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11160 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 11161 | { |
| 11162 | struct alc_spec *spec = codec->spec; |
| 11163 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11164 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11165 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11166 | alc262_hippo_master_update(codec); |
| 11167 | } |
| 11168 | |
| 11169 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11170 | { |
| 11171 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11172 | return; |
| 11173 | alc262_hippo_automute(codec); |
| 11174 | } |
| 11175 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11176 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11177 | { |
| 11178 | struct alc_spec *spec = codec->spec; |
| 11179 | |
| 11180 | spec->autocfg.hp_pins[0] = 0x15; |
| 11181 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11182 | } |
| 11183 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11184 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11185 | { |
| 11186 | struct alc_spec *spec = codec->spec; |
| 11187 | |
| 11188 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11189 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11190 | } |
| 11191 | |
| 11192 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11193 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11194 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11195 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11196 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11197 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11198 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11199 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11200 | { } /* end */ |
| 11201 | }; |
| 11202 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11203 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11204 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11205 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11206 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11207 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11208 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11209 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11210 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11211 | { } /* end */ |
| 11212 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11213 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11214 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11215 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11216 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11217 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11218 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11219 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11220 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11221 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11222 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11223 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11224 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11225 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11226 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11227 | { } /* end */ |
| 11228 | }; |
| 11229 | |
| 11230 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11231 | /* Headphone automute */ |
| 11232 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11233 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11234 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11235 | |
| 11236 | /* P11 AUX_IN, white 4-pin connector */ |
| 11237 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11238 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11239 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11240 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11241 | |
| 11242 | {} |
| 11243 | }; |
| 11244 | |
| 11245 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11246 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11247 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11248 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11249 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11250 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11251 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11252 | } |
| 11253 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11254 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11255 | #define alc262_capture_mixer alc882_capture_mixer |
| 11256 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11257 | |
| 11258 | /* |
| 11259 | * generic initialization of ADC, input mixers and output mixers |
| 11260 | */ |
| 11261 | static struct hda_verb alc262_init_verbs[] = { |
| 11262 | /* |
| 11263 | * Unmute ADC0-2 and set the default input to mic-in |
| 11264 | */ |
| 11265 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11266 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11267 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11268 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11269 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11270 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11271 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11272 | /* 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] | 11273 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11274 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11275 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11276 | */ |
| 11277 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11278 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11279 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11280 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11281 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11282 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11283 | |
| 11284 | /* |
| 11285 | * Set up output mixers (0x0c - 0x0e) |
| 11286 | */ |
| 11287 | /* set vol=0 to output mixers */ |
| 11288 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11289 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11290 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11291 | /* set up input amps for analog loopback */ |
| 11292 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11293 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11294 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11295 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11296 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11297 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11298 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11299 | |
| 11300 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11301 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11302 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11303 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11304 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11305 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11306 | |
| 11307 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11308 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11309 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11310 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11311 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11312 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11313 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11314 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11315 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11316 | /* FIXME: use matrix-type input source selection */ |
| 11317 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11318 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11319 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11320 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11321 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11322 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11323 | /* Input mixer2 */ |
| 11324 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11325 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11326 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11327 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11328 | /* Input mixer3 */ |
| 11329 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11330 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11331 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11332 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11333 | |
| 11334 | { } |
| 11335 | }; |
| 11336 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11337 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11338 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11339 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11340 | { } |
| 11341 | }; |
| 11342 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11343 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11344 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11345 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11346 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11347 | |
| 11348 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11349 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11350 | {} |
| 11351 | }; |
| 11352 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11353 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11354 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11355 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11356 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11357 | |
| 11358 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11359 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11360 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11361 | }; |
| 11362 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11363 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11364 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11365 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11366 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11367 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11368 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11369 | { } /* end */ |
| 11370 | }; |
| 11371 | |
| 11372 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11373 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11374 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11375 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11376 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11377 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11378 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11379 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11380 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11381 | {} |
| 11382 | }; |
| 11383 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11384 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11385 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11386 | struct alc_spec *spec = codec->spec; |
| 11387 | |
| 11388 | spec->autocfg.hp_pins[0] = 0x15; |
| 11389 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11390 | spec->ext_mic.pin = 0x18; |
| 11391 | spec->ext_mic.mux_idx = 0; |
| 11392 | spec->int_mic.pin = 0x12; |
| 11393 | spec->int_mic.mux_idx = 9; |
| 11394 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11395 | } |
| 11396 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11397 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11398 | * nec model |
| 11399 | * 0x15 = headphone |
| 11400 | * 0x16 = internal speaker |
| 11401 | * 0x18 = external mic |
| 11402 | */ |
| 11403 | |
| 11404 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11405 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11406 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11407 | |
| 11408 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11409 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11410 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11411 | |
| 11412 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11413 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11414 | { } /* end */ |
| 11415 | }; |
| 11416 | |
| 11417 | static struct hda_verb alc262_nec_verbs[] = { |
| 11418 | /* Unmute Speaker */ |
| 11419 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11420 | |
| 11421 | /* Headphone */ |
| 11422 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11423 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11424 | |
| 11425 | /* External mic to headphone */ |
| 11426 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11427 | /* External mic to speaker */ |
| 11428 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11429 | {} |
| 11430 | }; |
| 11431 | |
| 11432 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11433 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11434 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11435 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11436 | */ |
| 11437 | |
| 11438 | #define ALC_HP_EVENT 0x37 |
| 11439 | |
| 11440 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11441 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11442 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11443 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11444 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11445 | {} |
| 11446 | }; |
| 11447 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11448 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11449 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11450 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11451 | {} |
| 11452 | }; |
| 11453 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11454 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11455 | /* Front Mic pin: input vref at 50% */ |
| 11456 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11457 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11458 | {} |
| 11459 | }; |
| 11460 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11461 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11462 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11463 | .items = { |
| 11464 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11465 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11466 | { "CD", 0x4 }, |
| 11467 | }, |
| 11468 | }; |
| 11469 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11470 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11471 | .num_items = 5, |
| 11472 | .items = { |
| 11473 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11474 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11475 | { "Line", 0x2 }, |
| 11476 | { "CD", 0x4 }, |
| 11477 | { "AUX IN", 0x6 }, |
| 11478 | }, |
| 11479 | }; |
| 11480 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11481 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11482 | .num_items = 4, |
| 11483 | .items = { |
| 11484 | { "Mic", 0x0 }, |
| 11485 | { "Front Mic", 0x2 }, |
| 11486 | { "Line", 0x1 }, |
| 11487 | { "CD", 0x4 }, |
| 11488 | }, |
| 11489 | }; |
| 11490 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11491 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11492 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11493 | { |
| 11494 | struct alc_spec *spec = codec->spec; |
| 11495 | unsigned int mute; |
| 11496 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11497 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11498 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11499 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11500 | spec->sense_updated = 1; |
| 11501 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11502 | /* unmute internal speaker only if both HPs are unplugged and |
| 11503 | * master switch is on |
| 11504 | */ |
| 11505 | if (spec->jack_present) |
| 11506 | mute = HDA_AMP_MUTE; |
| 11507 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11508 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11509 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11510 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11511 | } |
| 11512 | |
| 11513 | /* unsolicited event for HP jack sensing */ |
| 11514 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11515 | unsigned int res) |
| 11516 | { |
| 11517 | if ((res >> 26) != ALC_HP_EVENT) |
| 11518 | return; |
| 11519 | alc262_fujitsu_automute(codec, 1); |
| 11520 | } |
| 11521 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11522 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11523 | { |
| 11524 | alc262_fujitsu_automute(codec, 1); |
| 11525 | } |
| 11526 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11527 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11528 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11529 | .ops = &snd_hda_bind_vol, |
| 11530 | .values = { |
| 11531 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11532 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11533 | 0 |
| 11534 | }, |
| 11535 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11536 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11537 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11538 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11539 | { |
| 11540 | struct alc_spec *spec = codec->spec; |
| 11541 | unsigned int mute; |
| 11542 | |
| 11543 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11544 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11545 | spec->sense_updated = 1; |
| 11546 | } |
| 11547 | if (spec->jack_present) { |
| 11548 | /* mute internal speaker */ |
| 11549 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11550 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11551 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11552 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11553 | } else { |
| 11554 | /* unmute internal speaker if necessary */ |
| 11555 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11556 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11557 | HDA_AMP_MUTE, mute); |
| 11558 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11559 | HDA_AMP_MUTE, mute); |
| 11560 | } |
| 11561 | } |
| 11562 | |
| 11563 | /* unsolicited event for HP jack sensing */ |
| 11564 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11565 | unsigned int res) |
| 11566 | { |
| 11567 | if ((res >> 26) != ALC_HP_EVENT) |
| 11568 | return; |
| 11569 | alc262_lenovo_3000_automute(codec, 1); |
| 11570 | } |
| 11571 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11572 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11573 | int dir, int idx, long *valp) |
| 11574 | { |
| 11575 | int i, change = 0; |
| 11576 | |
| 11577 | for (i = 0; i < 2; i++, valp++) |
| 11578 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11579 | HDA_AMP_MUTE, |
| 11580 | *valp ? 0 : HDA_AMP_MUTE); |
| 11581 | return change; |
| 11582 | } |
| 11583 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11584 | /* bind hp and internal speaker mute (with plug check) */ |
| 11585 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11586 | struct snd_ctl_elem_value *ucontrol) |
| 11587 | { |
| 11588 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11589 | long *valp = ucontrol->value.integer.value; |
| 11590 | int change; |
| 11591 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11592 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11593 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11594 | if (change) |
| 11595 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11596 | return change; |
| 11597 | } |
| 11598 | |
| 11599 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11600 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11601 | { |
| 11602 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11603 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11604 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11605 | .info = snd_hda_mixer_amp_switch_info, |
| 11606 | .get = snd_hda_mixer_amp_switch_get, |
| 11607 | .put = alc262_fujitsu_master_sw_put, |
| 11608 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11609 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11610 | { |
| 11611 | .iface = NID_MAPPING, |
| 11612 | .name = "Master Playback Switch", |
| 11613 | .private_value = 0x1b, |
| 11614 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11615 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11616 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11617 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11618 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11619 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11620 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11621 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11622 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11623 | { } /* end */ |
| 11624 | }; |
| 11625 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11626 | /* bind hp and internal speaker mute (with plug check) */ |
| 11627 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11628 | struct snd_ctl_elem_value *ucontrol) |
| 11629 | { |
| 11630 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11631 | long *valp = ucontrol->value.integer.value; |
| 11632 | int change; |
| 11633 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11634 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11635 | if (change) |
| 11636 | alc262_lenovo_3000_automute(codec, 0); |
| 11637 | return change; |
| 11638 | } |
| 11639 | |
| 11640 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11641 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11642 | { |
| 11643 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11644 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11645 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11646 | .info = snd_hda_mixer_amp_switch_info, |
| 11647 | .get = snd_hda_mixer_amp_switch_get, |
| 11648 | .put = alc262_lenovo_3000_master_sw_put, |
| 11649 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11650 | }, |
| 11651 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11652 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11653 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11654 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11655 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11656 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11657 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11658 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11659 | { } /* end */ |
| 11660 | }; |
| 11661 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11662 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11663 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11664 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11665 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11666 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11667 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11668 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11669 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11670 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11671 | { } /* end */ |
| 11672 | }; |
| 11673 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11674 | /* additional init verbs for Benq laptops */ |
| 11675 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11676 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11677 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11678 | {} |
| 11679 | }; |
| 11680 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11681 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11682 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11683 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11684 | |
| 11685 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11686 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11687 | {} |
| 11688 | }; |
| 11689 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11690 | /* Samsung Q1 Ultra Vista model setup */ |
| 11691 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11692 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11693 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11694 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11695 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11696 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11697 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11698 | { } /* end */ |
| 11699 | }; |
| 11700 | |
| 11701 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11702 | /* output mixer */ |
| 11703 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11704 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11705 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11706 | /* speaker */ |
| 11707 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11708 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11709 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11710 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11711 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11712 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11713 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11714 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11715 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11716 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11717 | /* internal mic */ |
| 11718 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11719 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11720 | /* ADC, choose mic */ |
| 11721 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11722 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11723 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11724 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11725 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11726 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11727 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11728 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11729 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11730 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11731 | {} |
| 11732 | }; |
| 11733 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11734 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11735 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11736 | { |
| 11737 | struct alc_spec *spec = codec->spec; |
| 11738 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11739 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11740 | mute = 0; |
| 11741 | /* auto-mute only when HP is used as HP */ |
| 11742 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11743 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11744 | if (spec->jack_present) |
| 11745 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11746 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11747 | /* mute/unmute internal speaker */ |
| 11748 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11749 | HDA_AMP_MUTE, mute); |
| 11750 | /* mute/unmute HP */ |
| 11751 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11752 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11753 | } |
| 11754 | |
| 11755 | /* unsolicited event for HP jack sensing */ |
| 11756 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11757 | unsigned int res) |
| 11758 | { |
| 11759 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11760 | return; |
| 11761 | alc262_ultra_automute(codec); |
| 11762 | } |
| 11763 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11764 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 11765 | .num_items = 2, |
| 11766 | .items = { |
| 11767 | { "Mic", 0x1 }, |
| 11768 | { "Headphone", 0x7 }, |
| 11769 | }, |
| 11770 | }; |
| 11771 | |
| 11772 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11773 | struct snd_ctl_elem_value *ucontrol) |
| 11774 | { |
| 11775 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11776 | struct alc_spec *spec = codec->spec; |
| 11777 | int ret; |
| 11778 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11779 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11780 | if (!ret) |
| 11781 | return 0; |
| 11782 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 11783 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11784 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11785 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 11786 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 11787 | return ret; |
| 11788 | } |
| 11789 | |
| 11790 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 11791 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 11792 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 11793 | { |
| 11794 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11795 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11796 | .info = alc_mux_enum_info, |
| 11797 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11798 | .put = alc262_ultra_mux_enum_put, |
| 11799 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11800 | { |
| 11801 | .iface = NID_MAPPING, |
| 11802 | .name = "Capture Source", |
| 11803 | .private_value = 0x15, |
| 11804 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11805 | { } /* end */ |
| 11806 | }; |
| 11807 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11808 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 11809 | * and thus it's bound with a different mixer. |
| 11810 | * This function returns which mixer amp should be used. |
| 11811 | */ |
| 11812 | static int alc262_check_volbit(hda_nid_t nid) |
| 11813 | { |
| 11814 | if (!nid) |
| 11815 | return 0; |
| 11816 | else if (nid == 0x16) |
| 11817 | return 2; |
| 11818 | else |
| 11819 | return 1; |
| 11820 | } |
| 11821 | |
| 11822 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11823 | const char *pfx, int *vbits) |
| 11824 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11825 | unsigned long val; |
| 11826 | int vbit; |
| 11827 | |
| 11828 | vbit = alc262_check_volbit(nid); |
| 11829 | if (!vbit) |
| 11830 | return 0; |
| 11831 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 11832 | return 0; |
| 11833 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11834 | if (vbit == 2) |
| 11835 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 11836 | else |
| 11837 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11838 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11839 | } |
| 11840 | |
| 11841 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11842 | const char *pfx) |
| 11843 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11844 | unsigned long val; |
| 11845 | |
| 11846 | if (!nid) |
| 11847 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11848 | if (nid == 0x16) |
| 11849 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 11850 | else |
| 11851 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11852 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11853 | } |
| 11854 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11855 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11856 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11857 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11858 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11859 | const char *pfx; |
| 11860 | int vbits; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11861 | int err; |
| 11862 | |
| 11863 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11864 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11865 | spec->multiout.dac_nids[0] = 2; |
| 11866 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11867 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 11868 | pfx = "Master"; |
| 11869 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11870 | pfx = "Speaker"; |
| 11871 | else |
| 11872 | pfx = "Front"; |
| 11873 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); |
| 11874 | if (err < 0) |
| 11875 | return err; |
| 11876 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); |
| 11877 | if (err < 0) |
| 11878 | return err; |
| 11879 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); |
| 11880 | if (err < 0) |
| 11881 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11882 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11883 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 11884 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 11885 | alc262_check_volbit(cfg->hp_pins[0]); |
| 11886 | if (vbits == 1 || vbits == 2) |
| 11887 | pfx = "Master"; /* only one mixer is used */ |
| 11888 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11889 | pfx = "Speaker"; |
| 11890 | else |
| 11891 | pfx = "Front"; |
| 11892 | vbits = 0; |
| 11893 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); |
| 11894 | if (err < 0) |
| 11895 | return err; |
| 11896 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", |
| 11897 | &vbits); |
| 11898 | if (err < 0) |
| 11899 | return err; |
| 11900 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", |
| 11901 | &vbits); |
| 11902 | if (err < 0) |
| 11903 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11904 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11905 | } |
| 11906 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11907 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 11908 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11909 | |
| 11910 | /* |
| 11911 | * generic initialization of ADC, input mixers and output mixers |
| 11912 | */ |
| 11913 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 11914 | /* |
| 11915 | * Unmute ADC0-2 and set the default input to mic-in |
| 11916 | */ |
| 11917 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11918 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11919 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11920 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11921 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11922 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11923 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11924 | /* 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] | 11925 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11926 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11927 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11928 | */ |
| 11929 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11930 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11931 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11932 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11933 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11934 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11935 | |
| 11936 | /* |
| 11937 | * Set up output mixers (0x0c - 0x0f) |
| 11938 | */ |
| 11939 | /* set vol=0 to output mixers */ |
| 11940 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11941 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11942 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11943 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11944 | /* set up input amps for analog loopback */ |
| 11945 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11946 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11947 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11948 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11949 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11950 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11951 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11952 | |
| 11953 | /* FIXME: use matrix-type input source selection */ |
| 11954 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11955 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11956 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11957 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11958 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11959 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11960 | /* Input mixer2 */ |
| 11961 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11962 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11963 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11964 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11965 | /* Input mixer3 */ |
| 11966 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11967 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11968 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11969 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11970 | |
| 11971 | { } |
| 11972 | }; |
| 11973 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11974 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 11975 | /* |
| 11976 | * Unmute ADC0-2 and set the default input to mic-in |
| 11977 | */ |
| 11978 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11979 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11980 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11981 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11982 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11983 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11984 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11985 | /* 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] | 11986 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11987 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11988 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11989 | */ |
| 11990 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11991 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11992 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11993 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11994 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11995 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11996 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11997 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11998 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11999 | /* |
| 12000 | * Set up output mixers (0x0c - 0x0e) |
| 12001 | */ |
| 12002 | /* set vol=0 to output mixers */ |
| 12003 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12004 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12005 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12006 | |
| 12007 | /* set up input amps for analog loopback */ |
| 12008 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12009 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12010 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12011 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12012 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12013 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12014 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12015 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12016 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12017 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12018 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12019 | |
| 12020 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12021 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12022 | |
| 12023 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12024 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12025 | |
| 12026 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12027 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12028 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12029 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12030 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12031 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12032 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12033 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12034 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12035 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12036 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12037 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12038 | |
| 12039 | |
| 12040 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12041 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12042 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12043 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12044 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12045 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12046 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12047 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12048 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12049 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12050 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12051 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12052 | /* Input mixer2 */ |
| 12053 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12054 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12055 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12056 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12057 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12058 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12059 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12060 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12061 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12062 | /* Input mixer3 */ |
| 12063 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12064 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12065 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12066 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12067 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12068 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12069 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12070 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12071 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12072 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12073 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12074 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12075 | { } |
| 12076 | }; |
| 12077 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12078 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12079 | /* |
| 12080 | * Unmute ADC0-2 and set the default input to mic-in |
| 12081 | */ |
| 12082 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12083 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12084 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12085 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12086 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12087 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12088 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12089 | /* 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] | 12090 | * mixer widget |
| 12091 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12092 | * panel mic (mic 2) |
| 12093 | */ |
| 12094 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12095 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12096 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12097 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12098 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12099 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12100 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12101 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12102 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12103 | /* |
| 12104 | * Set up output mixers (0x0c - 0x0e) |
| 12105 | */ |
| 12106 | /* set vol=0 to output mixers */ |
| 12107 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12108 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12109 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12110 | |
| 12111 | /* set up input amps for analog loopback */ |
| 12112 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12113 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12114 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12115 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12116 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12117 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12118 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12119 | |
| 12120 | |
| 12121 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12122 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12123 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12124 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12125 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12126 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12127 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12128 | |
| 12129 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12130 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12131 | |
| 12132 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12133 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12134 | |
| 12135 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12136 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12137 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12138 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12139 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12140 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12141 | |
| 12142 | /* FIXME: use matrix-type input source selection */ |
| 12143 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12144 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12145 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12146 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12147 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12148 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12149 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12150 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12151 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12152 | /* Input mixer2 */ |
| 12153 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12154 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12155 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12156 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12157 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12158 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12159 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12160 | /* Input mixer3 */ |
| 12161 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12162 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12163 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12164 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12165 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12166 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12167 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12168 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12169 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12170 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12171 | { } |
| 12172 | }; |
| 12173 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12174 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12175 | |
| 12176 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12177 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12178 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12179 | |
| 12180 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12181 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12182 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12183 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12184 | |
| 12185 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12186 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12187 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12188 | {} |
| 12189 | }; |
| 12190 | |
| 12191 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12192 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12193 | #define alc262_loopbacks alc880_loopbacks |
| 12194 | #endif |
| 12195 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12196 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12197 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12198 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12199 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12200 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12201 | |
| 12202 | /* |
| 12203 | * BIOS auto configuration |
| 12204 | */ |
| 12205 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12206 | { |
| 12207 | struct alc_spec *spec = codec->spec; |
| 12208 | int err; |
| 12209 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12210 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12211 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12212 | alc262_ignore); |
| 12213 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12214 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12215 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12216 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12217 | spec->multiout.max_channels = 2; |
| 12218 | spec->no_analog = 1; |
| 12219 | goto dig_only; |
| 12220 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12221 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12222 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12223 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12224 | if (err < 0) |
| 12225 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12226 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12227 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12228 | return err; |
| 12229 | |
| 12230 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12231 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12232 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12233 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12234 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12235 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12236 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12237 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12238 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12239 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12240 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12241 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12242 | err = alc_auto_add_mic_boost(codec); |
| 12243 | if (err < 0) |
| 12244 | return err; |
| 12245 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12246 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12247 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12248 | return 1; |
| 12249 | } |
| 12250 | |
| 12251 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12252 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12253 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12254 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12255 | |
| 12256 | |
| 12257 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12258 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12259 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12260 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12261 | alc262_auto_init_multi_out(codec); |
| 12262 | alc262_auto_init_hp_out(codec); |
| 12263 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12264 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12265 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12266 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12267 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12268 | } |
| 12269 | |
| 12270 | /* |
| 12271 | * configuration and preset |
| 12272 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12273 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 12274 | [ALC262_BASIC] = "basic", |
| 12275 | [ALC262_HIPPO] = "hippo", |
| 12276 | [ALC262_HIPPO_1] = "hippo_1", |
| 12277 | [ALC262_FUJITSU] = "fujitsu", |
| 12278 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12279 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12280 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12281 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12282 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12283 | [ALC262_BENQ_T31] = "benq-t31", |
| 12284 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12285 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12286 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12287 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12288 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12289 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12290 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12291 | [ALC262_AUTO] = "auto", |
| 12292 | }; |
| 12293 | |
| 12294 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12295 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12296 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12297 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12298 | ALC262_HP_BPC), |
| 12299 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12300 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12301 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12302 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12303 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12304 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12305 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12306 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12307 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12308 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12309 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12310 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12311 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12312 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12313 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12314 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12315 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12316 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12317 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12318 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12319 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12320 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12321 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12322 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12323 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12324 | #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] | 12325 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12326 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12327 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12328 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12329 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12330 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12331 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12332 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12333 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12334 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12335 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12336 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12337 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12338 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12339 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12340 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12341 | {} |
| 12342 | }; |
| 12343 | |
| 12344 | static struct alc_config_preset alc262_presets[] = { |
| 12345 | [ALC262_BASIC] = { |
| 12346 | .mixers = { alc262_base_mixer }, |
| 12347 | .init_verbs = { alc262_init_verbs }, |
| 12348 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12349 | .dac_nids = alc262_dac_nids, |
| 12350 | .hp_nid = 0x03, |
| 12351 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12352 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12353 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12354 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12355 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12356 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12357 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12358 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12359 | .dac_nids = alc262_dac_nids, |
| 12360 | .hp_nid = 0x03, |
| 12361 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12362 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12363 | .channel_mode = alc262_modes, |
| 12364 | .input_mux = &alc262_capture_source, |
| 12365 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12366 | .setup = alc262_hippo_setup, |
| 12367 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12368 | }, |
| 12369 | [ALC262_HIPPO_1] = { |
| 12370 | .mixers = { alc262_hippo1_mixer }, |
| 12371 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12372 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12373 | .dac_nids = alc262_dac_nids, |
| 12374 | .hp_nid = 0x02, |
| 12375 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12376 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12377 | .channel_mode = alc262_modes, |
| 12378 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12379 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12380 | .setup = alc262_hippo1_setup, |
| 12381 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12382 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12383 | [ALC262_FUJITSU] = { |
| 12384 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12385 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12386 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12387 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12388 | .dac_nids = alc262_dac_nids, |
| 12389 | .hp_nid = 0x03, |
| 12390 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12391 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12392 | .channel_mode = alc262_modes, |
| 12393 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12394 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12395 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12396 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12397 | [ALC262_HP_BPC] = { |
| 12398 | .mixers = { alc262_HP_BPC_mixer }, |
| 12399 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12400 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12401 | .dac_nids = alc262_dac_nids, |
| 12402 | .hp_nid = 0x03, |
| 12403 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12404 | .channel_mode = alc262_modes, |
| 12405 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12406 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12407 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12408 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12409 | [ALC262_HP_BPC_D7000_WF] = { |
| 12410 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12411 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12412 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12413 | .dac_nids = alc262_dac_nids, |
| 12414 | .hp_nid = 0x03, |
| 12415 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12416 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12417 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12418 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12419 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12420 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12421 | [ALC262_HP_BPC_D7000_WL] = { |
| 12422 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12423 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12424 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12425 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12426 | .dac_nids = alc262_dac_nids, |
| 12427 | .hp_nid = 0x03, |
| 12428 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12429 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12430 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12431 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12432 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12433 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12434 | [ALC262_HP_TC_T5735] = { |
| 12435 | .mixers = { alc262_hp_t5735_mixer }, |
| 12436 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12437 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12438 | .dac_nids = alc262_dac_nids, |
| 12439 | .hp_nid = 0x03, |
| 12440 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12441 | .channel_mode = alc262_modes, |
| 12442 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12443 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12444 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12445 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12446 | }, |
| 12447 | [ALC262_HP_RP5700] = { |
| 12448 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12449 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12450 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12451 | .dac_nids = alc262_dac_nids, |
| 12452 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12453 | .channel_mode = alc262_modes, |
| 12454 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12455 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12456 | [ALC262_BENQ_ED8] = { |
| 12457 | .mixers = { alc262_base_mixer }, |
| 12458 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12459 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12460 | .dac_nids = alc262_dac_nids, |
| 12461 | .hp_nid = 0x03, |
| 12462 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12463 | .channel_mode = alc262_modes, |
| 12464 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12465 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12466 | [ALC262_SONY_ASSAMD] = { |
| 12467 | .mixers = { alc262_sony_mixer }, |
| 12468 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12469 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12470 | .dac_nids = alc262_dac_nids, |
| 12471 | .hp_nid = 0x02, |
| 12472 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12473 | .channel_mode = alc262_modes, |
| 12474 | .input_mux = &alc262_capture_source, |
| 12475 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12476 | .setup = alc262_hippo_setup, |
| 12477 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12478 | }, |
| 12479 | [ALC262_BENQ_T31] = { |
| 12480 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12481 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12482 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12483 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12484 | .dac_nids = alc262_dac_nids, |
| 12485 | .hp_nid = 0x03, |
| 12486 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12487 | .channel_mode = alc262_modes, |
| 12488 | .input_mux = &alc262_capture_source, |
| 12489 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12490 | .setup = alc262_hippo_setup, |
| 12491 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12492 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12493 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12494 | .mixers = { alc262_ultra_mixer }, |
| 12495 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12496 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12497 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12498 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12499 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12500 | .channel_mode = alc262_modes, |
| 12501 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12502 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12503 | .capsrc_nids = alc262_capsrc_nids, |
| 12504 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12505 | .unsol_event = alc262_ultra_unsol_event, |
| 12506 | .init_hook = alc262_ultra_automute, |
| 12507 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12508 | [ALC262_LENOVO_3000] = { |
| 12509 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12510 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12511 | alc262_lenovo_3000_unsol_verbs, |
| 12512 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12513 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12514 | .dac_nids = alc262_dac_nids, |
| 12515 | .hp_nid = 0x03, |
| 12516 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12517 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12518 | .channel_mode = alc262_modes, |
| 12519 | .input_mux = &alc262_fujitsu_capture_source, |
| 12520 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12521 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12522 | [ALC262_NEC] = { |
| 12523 | .mixers = { alc262_nec_mixer }, |
| 12524 | .init_verbs = { alc262_nec_verbs }, |
| 12525 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12526 | .dac_nids = alc262_dac_nids, |
| 12527 | .hp_nid = 0x03, |
| 12528 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12529 | .channel_mode = alc262_modes, |
| 12530 | .input_mux = &alc262_capture_source, |
| 12531 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12532 | [ALC262_TOSHIBA_S06] = { |
| 12533 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12534 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12535 | alc262_eapd_verbs }, |
| 12536 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12537 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12538 | .dac_nids = alc262_dac_nids, |
| 12539 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12540 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12541 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12542 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12543 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12544 | .unsol_event = alc_sku_unsol_event, |
| 12545 | .setup = alc262_toshiba_s06_setup, |
| 12546 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12547 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12548 | [ALC262_TOSHIBA_RX1] = { |
| 12549 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12550 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12551 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12552 | .dac_nids = alc262_dac_nids, |
| 12553 | .hp_nid = 0x03, |
| 12554 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12555 | .channel_mode = alc262_modes, |
| 12556 | .input_mux = &alc262_capture_source, |
| 12557 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12558 | .setup = alc262_hippo_setup, |
| 12559 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12560 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12561 | [ALC262_TYAN] = { |
| 12562 | .mixers = { alc262_tyan_mixer }, |
| 12563 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12564 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12565 | .dac_nids = alc262_dac_nids, |
| 12566 | .hp_nid = 0x02, |
| 12567 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12568 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12569 | .channel_mode = alc262_modes, |
| 12570 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12571 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12572 | .setup = alc262_tyan_setup, |
| 12573 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12574 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12575 | }; |
| 12576 | |
| 12577 | static int patch_alc262(struct hda_codec *codec) |
| 12578 | { |
| 12579 | struct alc_spec *spec; |
| 12580 | int board_config; |
| 12581 | int err; |
| 12582 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12583 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12584 | if (spec == NULL) |
| 12585 | return -ENOMEM; |
| 12586 | |
| 12587 | codec->spec = spec; |
| 12588 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12589 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12590 | * under-run |
| 12591 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12592 | { |
| 12593 | int tmp; |
| 12594 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12595 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12596 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12597 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12598 | } |
| 12599 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12600 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12601 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12602 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12603 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12604 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12605 | alc262_models, |
| 12606 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12607 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12608 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12609 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12610 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12611 | board_config = ALC262_AUTO; |
| 12612 | } |
| 12613 | |
| 12614 | if (board_config == ALC262_AUTO) { |
| 12615 | /* automatic parse from the BIOS config */ |
| 12616 | err = alc262_parse_auto_config(codec); |
| 12617 | if (err < 0) { |
| 12618 | alc_free(codec); |
| 12619 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12620 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12621 | printk(KERN_INFO |
| 12622 | "hda_codec: Cannot set up configuration " |
| 12623 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12624 | board_config = ALC262_BASIC; |
| 12625 | } |
| 12626 | } |
| 12627 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12628 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12629 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12630 | if (err < 0) { |
| 12631 | alc_free(codec); |
| 12632 | return err; |
| 12633 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12634 | } |
| 12635 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12636 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12637 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12638 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12639 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12640 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12641 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12642 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12643 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12644 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12645 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12646 | int i; |
| 12647 | /* check whether the digital-mic has to be supported */ |
| 12648 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12649 | if (spec->input_mux->items[i].index >= 9) |
| 12650 | break; |
| 12651 | } |
| 12652 | if (i < spec->input_mux->num_items) { |
| 12653 | /* use only ADC0 */ |
| 12654 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12655 | spec->num_adc_nids = 1; |
| 12656 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12657 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12658 | /* all analog inputs */ |
| 12659 | /* check whether NID 0x07 is valid */ |
| 12660 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12661 | |
| 12662 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12663 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12664 | if (wcap != AC_WID_AUD_IN) { |
| 12665 | spec->adc_nids = alc262_adc_nids_alt; |
| 12666 | spec->num_adc_nids = |
| 12667 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12668 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12669 | } else { |
| 12670 | spec->adc_nids = alc262_adc_nids; |
| 12671 | spec->num_adc_nids = |
| 12672 | ARRAY_SIZE(alc262_adc_nids); |
| 12673 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12674 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12675 | } |
| 12676 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12677 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12678 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12679 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12680 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12681 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12682 | spec->vmaster_nid = 0x0c; |
| 12683 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12684 | codec->patch_ops = alc_patch_ops; |
| 12685 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12686 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12687 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12688 | if (!spec->loopback.amplist) |
| 12689 | spec->loopback.amplist = alc262_loopbacks; |
| 12690 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12691 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12692 | return 0; |
| 12693 | } |
| 12694 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12695 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12696 | * ALC268 channel source setting (2 channel) |
| 12697 | */ |
| 12698 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12699 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12700 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12701 | static hda_nid_t alc268_dac_nids[2] = { |
| 12702 | /* front, hp */ |
| 12703 | 0x02, 0x03 |
| 12704 | }; |
| 12705 | |
| 12706 | static hda_nid_t alc268_adc_nids[2] = { |
| 12707 | /* ADC0-1 */ |
| 12708 | 0x08, 0x07 |
| 12709 | }; |
| 12710 | |
| 12711 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 12712 | /* ADC0 */ |
| 12713 | 0x08 |
| 12714 | }; |
| 12715 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12716 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 12717 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12718 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 12719 | /* output mixer control */ |
| 12720 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12721 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12722 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12723 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12724 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12725 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12726 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12727 | { } |
| 12728 | }; |
| 12729 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12730 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 12731 | /* output mixer control */ |
| 12732 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12733 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12734 | ALC262_HIPPO_MASTER_SWITCH, |
| 12735 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12736 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12737 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12738 | { } |
| 12739 | }; |
| 12740 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12741 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 12742 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 12743 | .ops = &snd_hda_bind_sw, |
| 12744 | .values = { |
| 12745 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 12746 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 12747 | 0 |
| 12748 | }, |
| 12749 | }; |
| 12750 | |
| 12751 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 12752 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 12753 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 12754 | { } |
| 12755 | }; |
| 12756 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12757 | static struct hda_verb alc268_eapd_verbs[] = { |
| 12758 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12759 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12760 | { } |
| 12761 | }; |
| 12762 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12763 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12764 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 12765 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12766 | { } /* end */ |
| 12767 | }; |
| 12768 | |
| 12769 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12770 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 12771 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 12772 | .ops = &snd_hda_bind_vol, |
| 12773 | .values = { |
| 12774 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12775 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12776 | 0 |
| 12777 | }, |
| 12778 | }; |
| 12779 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12780 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12781 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 12782 | { |
| 12783 | struct alc_spec *spec = codec->spec; |
| 12784 | unsigned int mute; |
| 12785 | |
| 12786 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12787 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12788 | spec->sense_updated = 1; |
| 12789 | } |
| 12790 | if (spec->jack_present) |
| 12791 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 12792 | else /* unmute internal speaker if necessary */ |
| 12793 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 12794 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12795 | HDA_AMP_MUTE, mute); |
| 12796 | } |
| 12797 | |
| 12798 | |
| 12799 | /* bind hp and internal speaker mute (with plug check) */ |
| 12800 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 12801 | struct snd_ctl_elem_value *ucontrol) |
| 12802 | { |
| 12803 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12804 | long *valp = ucontrol->value.integer.value; |
| 12805 | int change; |
| 12806 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 12807 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12808 | if (change) |
| 12809 | alc268_acer_automute(codec, 0); |
| 12810 | return change; |
| 12811 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12812 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12813 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 12814 | /* output mixer control */ |
| 12815 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12816 | { |
| 12817 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12818 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12819 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12820 | .info = snd_hda_mixer_amp_switch_info, |
| 12821 | .get = snd_hda_mixer_amp_switch_get, |
| 12822 | .put = alc268_acer_master_sw_put, |
| 12823 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12824 | }, |
| 12825 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 12826 | { } |
| 12827 | }; |
| 12828 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12829 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 12830 | /* output mixer control */ |
| 12831 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12832 | { |
| 12833 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12834 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12835 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12836 | .info = snd_hda_mixer_amp_switch_info, |
| 12837 | .get = snd_hda_mixer_amp_switch_get, |
| 12838 | .put = alc268_acer_master_sw_put, |
| 12839 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12840 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12841 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12842 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12843 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12844 | { } |
| 12845 | }; |
| 12846 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12847 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 12848 | /* output mixer control */ |
| 12849 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12850 | { |
| 12851 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12852 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12853 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12854 | .info = snd_hda_mixer_amp_switch_info, |
| 12855 | .get = snd_hda_mixer_amp_switch_get, |
| 12856 | .put = alc268_acer_master_sw_put, |
| 12857 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12858 | }, |
| 12859 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12860 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12861 | { } |
| 12862 | }; |
| 12863 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12864 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 12865 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12866 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12867 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12868 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12869 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 12870 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 12871 | { } |
| 12872 | }; |
| 12873 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12874 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12875 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 12876 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12877 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12878 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12879 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12880 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12881 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12882 | { } |
| 12883 | }; |
| 12884 | |
| 12885 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12886 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12887 | #define alc268_toshiba_setup alc262_hippo_setup |
| 12888 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12889 | |
| 12890 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 12891 | unsigned int res) |
| 12892 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12893 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12894 | return; |
| 12895 | alc268_acer_automute(codec, 1); |
| 12896 | } |
| 12897 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12898 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 12899 | { |
| 12900 | alc268_acer_automute(codec, 1); |
| 12901 | } |
| 12902 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12903 | /* toggle speaker-output according to the hp-jack state */ |
| 12904 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 12905 | { |
| 12906 | unsigned int present; |
| 12907 | unsigned char bits; |
| 12908 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12909 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12910 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12911 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12912 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12913 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12914 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12915 | } |
| 12916 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12917 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 12918 | unsigned int res) |
| 12919 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12920 | switch (res >> 26) { |
| 12921 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12922 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12923 | break; |
| 12924 | case ALC880_MIC_EVENT: |
| 12925 | alc_mic_automute(codec); |
| 12926 | break; |
| 12927 | } |
| 12928 | } |
| 12929 | |
| 12930 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 12931 | { |
| 12932 | struct alc_spec *spec = codec->spec; |
| 12933 | spec->ext_mic.pin = 0x18; |
| 12934 | spec->ext_mic.mux_idx = 0; |
| 12935 | spec->int_mic.pin = 0x12; |
| 12936 | spec->int_mic.mux_idx = 6; |
| 12937 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12938 | } |
| 12939 | |
| 12940 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 12941 | { |
| 12942 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12943 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12944 | } |
| 12945 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12946 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 12947 | /* output mixer control */ |
| 12948 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12949 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12950 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12951 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12952 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12953 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12954 | { } |
| 12955 | }; |
| 12956 | |
| 12957 | static struct hda_verb alc268_dell_verbs[] = { |
| 12958 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12959 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12960 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12961 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12962 | { } |
| 12963 | }; |
| 12964 | |
| 12965 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12966 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12967 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12968 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12969 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12970 | spec->autocfg.hp_pins[0] = 0x15; |
| 12971 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12972 | spec->ext_mic.pin = 0x18; |
| 12973 | spec->ext_mic.mux_idx = 0; |
| 12974 | spec->int_mic.pin = 0x19; |
| 12975 | spec->int_mic.mux_idx = 1; |
| 12976 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12977 | } |
| 12978 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12979 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 12980 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12981 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12982 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12983 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12984 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12985 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12986 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12987 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12988 | { } |
| 12989 | }; |
| 12990 | |
| 12991 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 12992 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12993 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 12994 | { } |
| 12995 | }; |
| 12996 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12997 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12998 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12999 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13000 | spec->autocfg.hp_pins[0] = 0x15; |
| 13001 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13002 | spec->ext_mic.pin = 0x18; |
| 13003 | spec->ext_mic.mux_idx = 0; |
| 13004 | spec->int_mic.pin = 0x19; |
| 13005 | spec->int_mic.mux_idx = 1; |
| 13006 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13007 | } |
| 13008 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13009 | /* |
| 13010 | * generic initialization of ADC, input mixers and output mixers |
| 13011 | */ |
| 13012 | static struct hda_verb alc268_base_init_verbs[] = { |
| 13013 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13014 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13015 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13016 | |
| 13017 | /* |
| 13018 | * Set up output mixers (0x0c - 0x0e) |
| 13019 | */ |
| 13020 | /* set vol=0 to output mixers */ |
| 13021 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13022 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13023 | |
| 13024 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13025 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13026 | |
| 13027 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13028 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13029 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13030 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13031 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13032 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13033 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13034 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13035 | |
| 13036 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13037 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13038 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13039 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13040 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13041 | |
| 13042 | /* set PCBEEP vol = 0, mute connections */ |
| 13043 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13044 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13045 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13046 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13047 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13048 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13049 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13050 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13051 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13052 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13053 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13054 | { } |
| 13055 | }; |
| 13056 | |
| 13057 | /* |
| 13058 | * generic initialization of ADC, input mixers and output mixers |
| 13059 | */ |
| 13060 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 13061 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13062 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13063 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13064 | |
| 13065 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13066 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13067 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13068 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13069 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13070 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13071 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13072 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13073 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13074 | |
| 13075 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13076 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13077 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13078 | /* set PCBEEP vol = 0, mute connections */ |
| 13079 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13080 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13081 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13082 | |
| 13083 | { } |
| 13084 | }; |
| 13085 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13086 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13087 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13088 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13089 | { } /* end */ |
| 13090 | }; |
| 13091 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13092 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13093 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13094 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13095 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13096 | { } /* end */ |
| 13097 | }; |
| 13098 | |
| 13099 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13100 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13101 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13102 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13103 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13104 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13105 | { } /* end */ |
| 13106 | }; |
| 13107 | |
| 13108 | static struct hda_input_mux alc268_capture_source = { |
| 13109 | .num_items = 4, |
| 13110 | .items = { |
| 13111 | { "Mic", 0x0 }, |
| 13112 | { "Front Mic", 0x1 }, |
| 13113 | { "Line", 0x2 }, |
| 13114 | { "CD", 0x3 }, |
| 13115 | }, |
| 13116 | }; |
| 13117 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13118 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13119 | .num_items = 3, |
| 13120 | .items = { |
| 13121 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13122 | { "Internal Mic", 0x1 }, |
| 13123 | { "Line", 0x2 }, |
| 13124 | }, |
| 13125 | }; |
| 13126 | |
| 13127 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13128 | .num_items = 3, |
| 13129 | .items = { |
| 13130 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13131 | { "Internal Mic", 0x6 }, |
| 13132 | { "Line", 0x2 }, |
| 13133 | }, |
| 13134 | }; |
| 13135 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13136 | #ifdef CONFIG_SND_DEBUG |
| 13137 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13138 | /* Volume widgets */ |
| 13139 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13140 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13141 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13142 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13143 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13144 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13145 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13146 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13147 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13148 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13149 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13150 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13151 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13152 | /* The below appears problematic on some hardwares */ |
| 13153 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13154 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13155 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13156 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13157 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13158 | |
| 13159 | /* Modes for retasking pin widgets */ |
| 13160 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13161 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13162 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13163 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13164 | |
| 13165 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13166 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13167 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13168 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13169 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13170 | |
| 13171 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13172 | * The ALC268 does not have an SPDIF input. |
| 13173 | */ |
| 13174 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13175 | |
| 13176 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13177 | * this output to turn on an external amplifier. |
| 13178 | */ |
| 13179 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13180 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13181 | |
| 13182 | { } /* end */ |
| 13183 | }; |
| 13184 | #endif |
| 13185 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13186 | /* create input playback/capture controls for the given pin */ |
| 13187 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13188 | const char *ctlname, int idx) |
| 13189 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13190 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13191 | int err; |
| 13192 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13193 | switch (nid) { |
| 13194 | case 0x14: |
| 13195 | case 0x16: |
| 13196 | dac = 0x02; |
| 13197 | break; |
| 13198 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13199 | case 0x1a: /* ALC259/269 only */ |
| 13200 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13201 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13202 | dac = 0x03; |
| 13203 | break; |
| 13204 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13205 | snd_printd(KERN_WARNING "hda_codec: " |
| 13206 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13207 | return 0; |
| 13208 | } |
| 13209 | if (spec->multiout.dac_nids[0] != dac && |
| 13210 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13211 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13212 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13213 | HDA_OUTPUT)); |
| 13214 | if (err < 0) |
| 13215 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13216 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13217 | } |
| 13218 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13219 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13220 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13221 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13222 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13223 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13224 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13225 | if (err < 0) |
| 13226 | return err; |
| 13227 | return 0; |
| 13228 | } |
| 13229 | |
| 13230 | /* add playback controls from the parsed DAC table */ |
| 13231 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13232 | const struct auto_pin_cfg *cfg) |
| 13233 | { |
| 13234 | hda_nid_t nid; |
| 13235 | int err; |
| 13236 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13237 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13238 | |
| 13239 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13240 | if (nid) { |
| 13241 | const char *name; |
| 13242 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13243 | name = "Speaker"; |
| 13244 | else |
| 13245 | name = "Front"; |
| 13246 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13247 | if (err < 0) |
| 13248 | return err; |
| 13249 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13250 | |
| 13251 | nid = cfg->speaker_pins[0]; |
| 13252 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13253 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13254 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13255 | if (err < 0) |
| 13256 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13257 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13258 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13259 | if (err < 0) |
| 13260 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13261 | } |
| 13262 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13263 | if (nid) { |
| 13264 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13265 | if (err < 0) |
| 13266 | return err; |
| 13267 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13268 | |
| 13269 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13270 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13271 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13272 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13273 | if (err < 0) |
| 13274 | return err; |
| 13275 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13276 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13277 | } |
| 13278 | |
| 13279 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13280 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13281 | const struct auto_pin_cfg *cfg) |
| 13282 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13283 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13284 | } |
| 13285 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13286 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13287 | hda_nid_t nid, int pin_type) |
| 13288 | { |
| 13289 | int idx; |
| 13290 | |
| 13291 | alc_set_pin_output(codec, nid, pin_type); |
| 13292 | if (nid == 0x14 || nid == 0x16) |
| 13293 | idx = 0; |
| 13294 | else |
| 13295 | idx = 1; |
| 13296 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13297 | } |
| 13298 | |
| 13299 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13300 | { |
| 13301 | struct alc_spec *spec = codec->spec; |
| 13302 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 13303 | if (nid) { |
| 13304 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13305 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13306 | } |
| 13307 | } |
| 13308 | |
| 13309 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13310 | { |
| 13311 | struct alc_spec *spec = codec->spec; |
| 13312 | hda_nid_t pin; |
| 13313 | |
| 13314 | pin = spec->autocfg.hp_pins[0]; |
| 13315 | if (pin) |
| 13316 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 13317 | pin = spec->autocfg.speaker_pins[0]; |
| 13318 | if (pin) |
| 13319 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 13320 | } |
| 13321 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13322 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13323 | { |
| 13324 | struct alc_spec *spec = codec->spec; |
| 13325 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13326 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13327 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13328 | unsigned int dac_vol1, dac_vol2; |
| 13329 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13330 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13331 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13332 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13333 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13334 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13335 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13336 | AMP_IN_UNMUTE(1)); |
| 13337 | snd_hda_codec_write(codec, 0x10, 0, |
| 13338 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13339 | AMP_IN_UNMUTE(1)); |
| 13340 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13341 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13342 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13343 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13344 | snd_hda_codec_write(codec, 0x10, 0, |
| 13345 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13346 | } |
| 13347 | |
| 13348 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13349 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13350 | dac_vol2 = AMP_OUT_ZERO; |
| 13351 | else if (line_nid == 0x15) |
| 13352 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13353 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13354 | dac_vol2 = AMP_OUT_ZERO; |
| 13355 | else if (hp_nid == 0x15) |
| 13356 | dac_vol1 = AMP_OUT_ZERO; |
| 13357 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13358 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13359 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13360 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13361 | |
| 13362 | snd_hda_codec_write(codec, 0x02, 0, |
| 13363 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13364 | snd_hda_codec_write(codec, 0x03, 0, |
| 13365 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13366 | } |
| 13367 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13368 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13369 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13370 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13371 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13372 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13373 | |
| 13374 | /* |
| 13375 | * BIOS auto configuration |
| 13376 | */ |
| 13377 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13378 | { |
| 13379 | struct alc_spec *spec = codec->spec; |
| 13380 | int err; |
| 13381 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13382 | |
| 13383 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13384 | alc268_ignore); |
| 13385 | if (err < 0) |
| 13386 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13387 | if (!spec->autocfg.line_outs) { |
| 13388 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13389 | spec->multiout.max_channels = 2; |
| 13390 | spec->no_analog = 1; |
| 13391 | goto dig_only; |
| 13392 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13393 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13394 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13395 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13396 | if (err < 0) |
| 13397 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13398 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13399 | if (err < 0) |
| 13400 | return err; |
| 13401 | |
| 13402 | spec->multiout.max_channels = 2; |
| 13403 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13404 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13405 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13406 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13407 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13408 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13409 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13410 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13411 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13412 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13413 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13414 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13415 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13416 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13417 | err = alc_auto_add_mic_boost(codec); |
| 13418 | if (err < 0) |
| 13419 | return err; |
| 13420 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13421 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13422 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13423 | return 1; |
| 13424 | } |
| 13425 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13426 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13427 | |
| 13428 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13429 | static void alc268_auto_init(struct hda_codec *codec) |
| 13430 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13431 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13432 | alc268_auto_init_multi_out(codec); |
| 13433 | alc268_auto_init_hp_out(codec); |
| 13434 | alc268_auto_init_mono_speaker_out(codec); |
| 13435 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13436 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13437 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13438 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13439 | } |
| 13440 | |
| 13441 | /* |
| 13442 | * configuration and preset |
| 13443 | */ |
| 13444 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13445 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13446 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13447 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13448 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13449 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13450 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13451 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13452 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13453 | #ifdef CONFIG_SND_DEBUG |
| 13454 | [ALC268_TEST] = "test", |
| 13455 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13456 | [ALC268_AUTO] = "auto", |
| 13457 | }; |
| 13458 | |
| 13459 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13460 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13461 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13462 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13463 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13464 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13465 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13466 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13467 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13468 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13469 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13470 | /* almost compatible with toshiba but with optional digital outs; |
| 13471 | * auto-probing seems working fine |
| 13472 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13473 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13474 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13475 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13476 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13477 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13478 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13479 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13480 | {} |
| 13481 | }; |
| 13482 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13483 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13484 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13485 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13486 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13487 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13488 | ALC268_TOSHIBA), |
| 13489 | {} |
| 13490 | }; |
| 13491 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13492 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13493 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13494 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13495 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13496 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13497 | alc267_quanta_il1_verbs }, |
| 13498 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13499 | .dac_nids = alc268_dac_nids, |
| 13500 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13501 | .adc_nids = alc268_adc_nids_alt, |
| 13502 | .hp_nid = 0x03, |
| 13503 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13504 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13505 | .unsol_event = alc_sku_unsol_event, |
| 13506 | .setup = alc267_quanta_il1_setup, |
| 13507 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13508 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13509 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13510 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13511 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13512 | .init_verbs = { alc268_base_init_verbs }, |
| 13513 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13514 | .dac_nids = alc268_dac_nids, |
| 13515 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13516 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13517 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13518 | .hp_nid = 0x03, |
| 13519 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13520 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13521 | .channel_mode = alc268_modes, |
| 13522 | .input_mux = &alc268_capture_source, |
| 13523 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13524 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13525 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13526 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13527 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13528 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13529 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13530 | .dac_nids = alc268_dac_nids, |
| 13531 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13532 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13533 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13534 | .hp_nid = 0x03, |
| 13535 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13536 | .channel_mode = alc268_modes, |
| 13537 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13538 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13539 | .setup = alc268_toshiba_setup, |
| 13540 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13541 | }, |
| 13542 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13543 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13544 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13545 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13546 | alc268_acer_verbs }, |
| 13547 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13548 | .dac_nids = alc268_dac_nids, |
| 13549 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13550 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13551 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13552 | .hp_nid = 0x02, |
| 13553 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13554 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13555 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13556 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13557 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13558 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13559 | [ALC268_ACER_DMIC] = { |
| 13560 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13561 | alc268_beep_mixer }, |
| 13562 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13563 | alc268_acer_verbs }, |
| 13564 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13565 | .dac_nids = alc268_dac_nids, |
| 13566 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13567 | .adc_nids = alc268_adc_nids_alt, |
| 13568 | .capsrc_nids = alc268_capsrc_nids, |
| 13569 | .hp_nid = 0x02, |
| 13570 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13571 | .channel_mode = alc268_modes, |
| 13572 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13573 | .unsol_event = alc268_acer_unsol_event, |
| 13574 | .init_hook = alc268_acer_init_hook, |
| 13575 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13576 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13577 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13578 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13579 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13580 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13581 | alc268_acer_aspire_one_verbs }, |
| 13582 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13583 | .dac_nids = alc268_dac_nids, |
| 13584 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13585 | .adc_nids = alc268_adc_nids_alt, |
| 13586 | .capsrc_nids = alc268_capsrc_nids, |
| 13587 | .hp_nid = 0x03, |
| 13588 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13589 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13590 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13591 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13592 | .init_hook = alc268_acer_lc_init_hook, |
| 13593 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13594 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13595 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13596 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13597 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13598 | alc268_dell_verbs }, |
| 13599 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13600 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13601 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13602 | .adc_nids = alc268_adc_nids_alt, |
| 13603 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13604 | .hp_nid = 0x02, |
| 13605 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13606 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13607 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13608 | .setup = alc268_dell_setup, |
| 13609 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13610 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13611 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13612 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13613 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13614 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13615 | alc268_toshiba_verbs }, |
| 13616 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13617 | .dac_nids = alc268_dac_nids, |
| 13618 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13619 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13620 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13621 | .hp_nid = 0x03, |
| 13622 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13623 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13624 | .channel_mode = alc268_modes, |
| 13625 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13626 | .setup = alc268_toshiba_setup, |
| 13627 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13628 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13629 | #ifdef CONFIG_SND_DEBUG |
| 13630 | [ALC268_TEST] = { |
| 13631 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13632 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13633 | alc268_volume_init_verbs }, |
| 13634 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13635 | .dac_nids = alc268_dac_nids, |
| 13636 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13637 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13638 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13639 | .hp_nid = 0x03, |
| 13640 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13641 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13642 | .channel_mode = alc268_modes, |
| 13643 | .input_mux = &alc268_capture_source, |
| 13644 | }, |
| 13645 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13646 | }; |
| 13647 | |
| 13648 | static int patch_alc268(struct hda_codec *codec) |
| 13649 | { |
| 13650 | struct alc_spec *spec; |
| 13651 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13652 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13653 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13654 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13655 | if (spec == NULL) |
| 13656 | return -ENOMEM; |
| 13657 | |
| 13658 | codec->spec = spec; |
| 13659 | |
| 13660 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13661 | alc268_models, |
| 13662 | alc268_cfg_tbl); |
| 13663 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13664 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13665 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13666 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13667 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13668 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13669 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13670 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13671 | board_config = ALC268_AUTO; |
| 13672 | } |
| 13673 | |
| 13674 | if (board_config == ALC268_AUTO) { |
| 13675 | /* automatic parse from the BIOS config */ |
| 13676 | err = alc268_parse_auto_config(codec); |
| 13677 | if (err < 0) { |
| 13678 | alc_free(codec); |
| 13679 | return err; |
| 13680 | } else if (!err) { |
| 13681 | printk(KERN_INFO |
| 13682 | "hda_codec: Cannot set up configuration " |
| 13683 | "from BIOS. Using base mode...\n"); |
| 13684 | board_config = ALC268_3ST; |
| 13685 | } |
| 13686 | } |
| 13687 | |
| 13688 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13689 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13690 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13691 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 13692 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13693 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13694 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13695 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 13696 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13697 | has_beep = 0; |
| 13698 | for (i = 0; i < spec->num_mixers; i++) { |
| 13699 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 13700 | has_beep = 1; |
| 13701 | break; |
| 13702 | } |
| 13703 | } |
| 13704 | |
| 13705 | if (has_beep) { |
| 13706 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13707 | if (err < 0) { |
| 13708 | alc_free(codec); |
| 13709 | return err; |
| 13710 | } |
| 13711 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 13712 | /* override the amp caps for beep generator */ |
| 13713 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13714 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 13715 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 13716 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 13717 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13718 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13719 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13720 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13721 | /* check whether NID 0x07 is valid */ |
| 13722 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13723 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13724 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13725 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13726 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13727 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13728 | if (spec->auto_mic || |
| 13729 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13730 | spec->adc_nids = alc268_adc_nids_alt; |
| 13731 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13732 | if (spec->auto_mic) |
| 13733 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13734 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 13735 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 13736 | else |
| 13737 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13738 | } else { |
| 13739 | spec->adc_nids = alc268_adc_nids; |
| 13740 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13741 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13742 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13743 | /* set default input source */ |
| 13744 | for (i = 0; i < spec->num_adc_nids; i++) |
| 13745 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 13746 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13747 | i < spec->num_mux_defs ? |
| 13748 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13749 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13750 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13751 | |
| 13752 | spec->vmaster_nid = 0x02; |
| 13753 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13754 | codec->patch_ops = alc_patch_ops; |
| 13755 | if (board_config == ALC268_AUTO) |
| 13756 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13757 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13758 | return 0; |
| 13759 | } |
| 13760 | |
| 13761 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13762 | * ALC269 channel source setting (2 channel) |
| 13763 | */ |
| 13764 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 13765 | |
| 13766 | #define alc269_dac_nids alc260_dac_nids |
| 13767 | |
| 13768 | static hda_nid_t alc269_adc_nids[1] = { |
| 13769 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13770 | 0x08, |
| 13771 | }; |
| 13772 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13773 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 13774 | 0x23, |
| 13775 | }; |
| 13776 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13777 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 13778 | /* ADC1 */ |
| 13779 | 0x09, |
| 13780 | }; |
| 13781 | |
| 13782 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 13783 | 0x22, |
| 13784 | }; |
| 13785 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 13786 | static hda_nid_t alc269_adc_candidates[] = { |
| 13787 | 0x08, 0x09, 0x07, |
| 13788 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13789 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13790 | #define alc269_modes alc260_modes |
| 13791 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 13792 | |
| 13793 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 13794 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13795 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13796 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13797 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13798 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13799 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13800 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13801 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13802 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13803 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13804 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13805 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 13806 | { } /* end */ |
| 13807 | }; |
| 13808 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13809 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 13810 | /* output mixer control */ |
| 13811 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13812 | { |
| 13813 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13814 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13815 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13816 | .info = snd_hda_mixer_amp_switch_info, |
| 13817 | .get = snd_hda_mixer_amp_switch_get, |
| 13818 | .put = alc268_acer_master_sw_put, |
| 13819 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13820 | }, |
| 13821 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13822 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13823 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13824 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13825 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13826 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13827 | { } |
| 13828 | }; |
| 13829 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13830 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 13831 | /* output mixer control */ |
| 13832 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13833 | { |
| 13834 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13835 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13836 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13837 | .info = snd_hda_mixer_amp_switch_info, |
| 13838 | .get = snd_hda_mixer_amp_switch_get, |
| 13839 | .put = alc268_acer_master_sw_put, |
| 13840 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13841 | }, |
| 13842 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13843 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13844 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13845 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13846 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13847 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13848 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 13849 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 13850 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13851 | { } |
| 13852 | }; |
| 13853 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13854 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13855 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13856 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13857 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13858 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13859 | { } /* end */ |
| 13860 | }; |
| 13861 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13862 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 13863 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13864 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13865 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13866 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13867 | { } /* end */ |
| 13868 | }; |
| 13869 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 13870 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
| 13871 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13872 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 13873 | { } /* end */ |
| 13874 | }; |
| 13875 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13876 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13877 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 13878 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13879 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 13880 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13881 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13882 | { } /* end */ |
| 13883 | }; |
| 13884 | |
| 13885 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13886 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13887 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13888 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13889 | { } /* end */ |
| 13890 | }; |
| 13891 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13892 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 13893 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13894 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13895 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13896 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13897 | { } /* end */ |
| 13898 | }; |
| 13899 | |
| 13900 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 13901 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13902 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13903 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13904 | { } /* end */ |
| 13905 | }; |
| 13906 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13907 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13908 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13909 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13910 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 13911 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13912 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13913 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13914 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13915 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13916 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13917 | { } |
| 13918 | }; |
| 13919 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13920 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 13921 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13922 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13923 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13924 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13925 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13926 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13927 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13928 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13929 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13930 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13931 | { } |
| 13932 | }; |
| 13933 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13934 | /* toggle speaker-output according to the hp-jack state */ |
| 13935 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 13936 | { |
| 13937 | unsigned int present; |
| 13938 | unsigned char bits; |
| 13939 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13940 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13941 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13942 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13943 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13944 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13945 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13946 | |
| 13947 | snd_hda_codec_write(codec, 0x20, 0, |
| 13948 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13949 | snd_hda_codec_write(codec, 0x20, 0, |
| 13950 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13951 | |
| 13952 | snd_hda_codec_write(codec, 0x20, 0, |
| 13953 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13954 | snd_hda_codec_write(codec, 0x20, 0, |
| 13955 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13956 | } |
| 13957 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13958 | /* toggle speaker-output according to the hp-jacks state */ |
| 13959 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 13960 | { |
| 13961 | unsigned int present; |
| 13962 | unsigned char bits; |
| 13963 | |
| 13964 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13965 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13966 | |
| 13967 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13968 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13969 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13970 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13971 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13972 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13973 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13974 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13975 | |
| 13976 | snd_hda_codec_write(codec, 0x20, 0, |
| 13977 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13978 | snd_hda_codec_write(codec, 0x20, 0, |
| 13979 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13980 | |
| 13981 | snd_hda_codec_write(codec, 0x20, 0, |
| 13982 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13983 | snd_hda_codec_write(codec, 0x20, 0, |
| 13984 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13985 | } |
| 13986 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13987 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 13988 | { |
| 13989 | unsigned int present_laptop; |
| 13990 | unsigned int present_dock; |
| 13991 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13992 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 13993 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13994 | |
| 13995 | /* Laptop mic port overrides dock mic port, design decision */ |
| 13996 | if (present_dock) |
| 13997 | snd_hda_codec_write(codec, 0x23, 0, |
| 13998 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 13999 | if (present_laptop) |
| 14000 | snd_hda_codec_write(codec, 0x23, 0, |
| 14001 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14002 | if (!present_dock && !present_laptop) |
| 14003 | snd_hda_codec_write(codec, 0x23, 0, |
| 14004 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14005 | } |
| 14006 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14007 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14008 | unsigned int res) |
| 14009 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14010 | switch (res >> 26) { |
| 14011 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14012 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14013 | break; |
| 14014 | case ALC880_MIC_EVENT: |
| 14015 | alc_mic_automute(codec); |
| 14016 | break; |
| 14017 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14018 | } |
| 14019 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14020 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14021 | unsigned int res) |
| 14022 | { |
| 14023 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14024 | alc269_lifebook_speaker_automute(codec); |
| 14025 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14026 | alc269_lifebook_mic_autoswitch(codec); |
| 14027 | } |
| 14028 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14029 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14030 | { |
| 14031 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14032 | spec->autocfg.hp_pins[0] = 0x15; |
| 14033 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14034 | spec->ext_mic.pin = 0x18; |
| 14035 | spec->ext_mic.mux_idx = 0; |
| 14036 | spec->int_mic.pin = 0x19; |
| 14037 | spec->int_mic.mux_idx = 1; |
| 14038 | spec->auto_mic = 1; |
| 14039 | } |
| 14040 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14041 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14042 | { |
| 14043 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14044 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14045 | } |
| 14046 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14047 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14048 | { |
| 14049 | alc269_lifebook_speaker_automute(codec); |
| 14050 | alc269_lifebook_mic_autoswitch(codec); |
| 14051 | } |
| 14052 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14053 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14054 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14055 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14056 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14057 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14058 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14059 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14060 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14061 | {} |
| 14062 | }; |
| 14063 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14064 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14065 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14066 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14067 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14068 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14069 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14070 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14071 | {} |
| 14072 | }; |
| 14073 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14074 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 14075 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14076 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14077 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14078 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14079 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14080 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14081 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14082 | {} |
| 14083 | }; |
| 14084 | |
| 14085 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14086 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14087 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14088 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14089 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14090 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14091 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14092 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14093 | {} |
| 14094 | }; |
| 14095 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14096 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
| 14097 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14098 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14099 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14100 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14101 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14102 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14103 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14104 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14105 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14106 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14107 | { } |
| 14108 | }; |
| 14109 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14110 | /* toggle speaker-output according to the hp-jack state */ |
| 14111 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 14112 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14113 | struct alc_spec *spec = codec->spec; |
| 14114 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14115 | unsigned int present; |
| 14116 | unsigned char bits; |
| 14117 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14118 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14119 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14120 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14121 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14122 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14123 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14124 | } |
| 14125 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14126 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14127 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14128 | unsigned int res) |
| 14129 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14130 | switch (res >> 26) { |
| 14131 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14132 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14133 | break; |
| 14134 | case ALC880_MIC_EVENT: |
| 14135 | alc_mic_automute(codec); |
| 14136 | break; |
| 14137 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14138 | } |
| 14139 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14140 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14141 | { |
| 14142 | struct alc_spec *spec = codec->spec; |
| 14143 | spec->autocfg.hp_pins[0] = 0x15; |
| 14144 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14145 | spec->ext_mic.pin = 0x18; |
| 14146 | spec->ext_mic.mux_idx = 0; |
| 14147 | spec->int_mic.pin = 0x19; |
| 14148 | spec->int_mic.mux_idx = 1; |
| 14149 | spec->auto_mic = 1; |
| 14150 | } |
| 14151 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14152 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14153 | { |
| 14154 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14155 | spec->autocfg.hp_pins[0] = 0x15; |
| 14156 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14157 | spec->ext_mic.pin = 0x18; |
| 14158 | spec->ext_mic.mux_idx = 0; |
| 14159 | spec->int_mic.pin = 0x12; |
| 14160 | spec->int_mic.mux_idx = 5; |
| 14161 | spec->auto_mic = 1; |
| 14162 | } |
| 14163 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14164 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14165 | { |
| 14166 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14167 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14168 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14169 | spec->ext_mic.pin = 0x18; |
| 14170 | spec->ext_mic.mux_idx = 0; |
| 14171 | spec->int_mic.pin = 0x19; |
| 14172 | spec->int_mic.mux_idx = 1; |
| 14173 | spec->auto_mic = 1; |
| 14174 | } |
| 14175 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14176 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14177 | { |
| 14178 | struct alc_spec *spec = codec->spec; |
| 14179 | spec->autocfg.hp_pins[0] = 0x21; |
| 14180 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14181 | spec->ext_mic.pin = 0x18; |
| 14182 | spec->ext_mic.mux_idx = 0; |
| 14183 | spec->int_mic.pin = 0x12; |
| 14184 | spec->int_mic.mux_idx = 6; |
| 14185 | spec->auto_mic = 1; |
| 14186 | } |
| 14187 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14188 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14189 | { |
| 14190 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14191 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14192 | } |
| 14193 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14194 | /* |
| 14195 | * generic initialization of ADC, input mixers and output mixers |
| 14196 | */ |
| 14197 | static struct hda_verb alc269_init_verbs[] = { |
| 14198 | /* |
| 14199 | * Unmute ADC0 and set the default input to mic-in |
| 14200 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14201 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14202 | |
| 14203 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14204 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14205 | */ |
| 14206 | /* set vol=0 to output mixers */ |
| 14207 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14208 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14209 | |
| 14210 | /* set up input amps for analog loopback */ |
| 14211 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14212 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14213 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14214 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14215 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14216 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14217 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14218 | |
| 14219 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14220 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14221 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14222 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14223 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14224 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14225 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14226 | |
| 14227 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14228 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14229 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14230 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14231 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14232 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14233 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14234 | |
| 14235 | /* set EAPD */ |
| 14236 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14237 | { } |
| 14238 | }; |
| 14239 | |
| 14240 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14241 | /* |
| 14242 | * Unmute ADC0 and set the default input to mic-in |
| 14243 | */ |
| 14244 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14245 | |
| 14246 | /* |
| 14247 | * Set up output mixers (0x02 - 0x03) |
| 14248 | */ |
| 14249 | /* set vol=0 to output mixers */ |
| 14250 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14251 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14252 | |
| 14253 | /* set up input amps for analog loopback */ |
| 14254 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14255 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14256 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14257 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14258 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14259 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14260 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14261 | |
| 14262 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14263 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14264 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14265 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14266 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14267 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14268 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14269 | |
| 14270 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14271 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14272 | |
| 14273 | /* FIXME: use Mux-type input source selection */ |
| 14274 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14275 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14276 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14277 | |
| 14278 | /* set EAPD */ |
| 14279 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14280 | { } |
| 14281 | }; |
| 14282 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14283 | #define alc269_auto_create_multi_out_ctls \ |
| 14284 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14285 | #define alc269_auto_create_input_ctls \ |
| 14286 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14287 | |
| 14288 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14289 | #define alc269_loopbacks alc880_loopbacks |
| 14290 | #endif |
| 14291 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14292 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14293 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14294 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14295 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14296 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14297 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14298 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14299 | .substreams = 1, |
| 14300 | .channels_min = 2, |
| 14301 | .channels_max = 8, |
| 14302 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14303 | /* NID is set in alc_build_pcms */ |
| 14304 | .ops = { |
| 14305 | .open = alc880_playback_pcm_open, |
| 14306 | .prepare = alc880_playback_pcm_prepare, |
| 14307 | .cleanup = alc880_playback_pcm_cleanup |
| 14308 | }, |
| 14309 | }; |
| 14310 | |
| 14311 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14312 | .substreams = 1, |
| 14313 | .channels_min = 2, |
| 14314 | .channels_max = 2, |
| 14315 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14316 | /* NID is set in alc_build_pcms */ |
| 14317 | }; |
| 14318 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14319 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14320 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14321 | { |
| 14322 | switch (codec->subsystem_id) { |
| 14323 | case 0x103c1586: |
| 14324 | return 1; |
| 14325 | } |
| 14326 | return 0; |
| 14327 | } |
| 14328 | |
| 14329 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14330 | { |
| 14331 | /* update mute-LED according to the speaker mute state */ |
| 14332 | if (nid == 0x01 || nid == 0x14) { |
| 14333 | int pinval; |
| 14334 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14335 | HDA_AMP_MUTE) |
| 14336 | pinval = 0x24; |
| 14337 | else |
| 14338 | pinval = 0x20; |
| 14339 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a54 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14340 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14341 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14342 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14343 | } |
| 14344 | return alc_check_power_status(codec, nid); |
| 14345 | } |
| 14346 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14347 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14348 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14349 | { |
| 14350 | struct alc_spec *spec = codec->spec; |
| 14351 | |
| 14352 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14353 | return 0; |
| 14354 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14355 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14356 | if (spec->ext_mic.pin <= 0x12) { |
| 14357 | spec->private_adc_nids[0] = 0x08; |
| 14358 | spec->private_adc_nids[1] = 0x11; |
| 14359 | spec->private_capsrc_nids[0] = 0x23; |
| 14360 | spec->private_capsrc_nids[1] = 0x22; |
| 14361 | } else { |
| 14362 | spec->private_adc_nids[0] = 0x11; |
| 14363 | spec->private_adc_nids[1] = 0x08; |
| 14364 | spec->private_capsrc_nids[0] = 0x22; |
| 14365 | spec->private_capsrc_nids[1] = 0x23; |
| 14366 | } |
| 14367 | spec->adc_nids = spec->private_adc_nids; |
| 14368 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14369 | spec->num_adc_nids = 2; |
| 14370 | spec->dual_adc_switch = 1; |
| 14371 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14372 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14373 | return 1; |
| 14374 | } |
| 14375 | return 0; |
| 14376 | } |
| 14377 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14378 | /* |
| 14379 | * BIOS auto configuration |
| 14380 | */ |
| 14381 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14382 | { |
| 14383 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14384 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14385 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14386 | |
| 14387 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14388 | alc269_ignore); |
| 14389 | if (err < 0) |
| 14390 | return err; |
| 14391 | |
| 14392 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14393 | if (err < 0) |
| 14394 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14395 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14396 | if (err < 0) |
| 14397 | return err; |
| 14398 | |
| 14399 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14400 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14401 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14402 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14403 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14404 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14405 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14406 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { |
| 14407 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14408 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14409 | } else { |
| 14410 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14411 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14412 | } |
| 14413 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14414 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14415 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14416 | |
| 14417 | if (!alc275_setup_dual_adc(codec)) |
| 14418 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14419 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14420 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14421 | /* set default input source */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14422 | if (!spec->dual_adc_switch) |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 14423 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], |
| 14424 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14425 | |
| 14426 | err = alc_auto_add_mic_boost(codec); |
| 14427 | if (err < 0) |
| 14428 | return err; |
| 14429 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14430 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14431 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14432 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14433 | return 1; |
| 14434 | } |
| 14435 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14436 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14437 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14438 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14439 | |
| 14440 | |
| 14441 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14442 | static void alc269_auto_init(struct hda_codec *codec) |
| 14443 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14444 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14445 | alc269_auto_init_multi_out(codec); |
| 14446 | alc269_auto_init_hp_out(codec); |
| 14447 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14448 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14449 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14450 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14451 | } |
| 14452 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14453 | enum { |
| 14454 | ALC269_FIXUP_SONY_VAIO, |
| 14455 | }; |
| 14456 | |
Tobias Klauser | fbc2566 | 2010-05-20 10:40:55 +0200 | [diff] [blame] | 14457 | static const struct hda_verb alc269_sony_vaio_fixup_verbs[] = { |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14458 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14459 | {} |
| 14460 | }; |
| 14461 | |
| 14462 | static const struct alc_fixup alc269_fixups[] = { |
| 14463 | [ALC269_FIXUP_SONY_VAIO] = { |
| 14464 | .verbs = alc269_sony_vaio_fixup_verbs |
| 14465 | }, |
| 14466 | }; |
| 14467 | |
| 14468 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
| 14469 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
| 14470 | {} |
| 14471 | }; |
| 14472 | |
| 14473 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14474 | /* |
| 14475 | * configuration and preset |
| 14476 | */ |
| 14477 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14478 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14479 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14480 | [ALC269_AMIC] = "laptop-amic", |
| 14481 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14482 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14483 | [ALC269_LIFEBOOK] = "lifebook", |
| 14484 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14485 | }; |
| 14486 | |
| 14487 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14488 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14489 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14490 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14491 | ALC269_AMIC), |
| 14492 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14493 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14494 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14495 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14496 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14497 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14498 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14499 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14500 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 14501 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 14502 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14503 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14504 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14505 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14506 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14507 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14508 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14509 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14510 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14511 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14512 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14513 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14514 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14515 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14516 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14517 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14518 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14519 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14520 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14521 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14522 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14523 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14524 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14525 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14526 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14527 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14528 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14529 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14530 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14531 | ALC269_DMIC), |
| 14532 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14533 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14534 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14535 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14536 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14537 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14538 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14539 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14540 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14541 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14542 | {} |
| 14543 | }; |
| 14544 | |
| 14545 | static struct alc_config_preset alc269_presets[] = { |
| 14546 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14547 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14548 | .init_verbs = { alc269_init_verbs }, |
| 14549 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14550 | .dac_nids = alc269_dac_nids, |
| 14551 | .hp_nid = 0x03, |
| 14552 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14553 | .channel_mode = alc269_modes, |
| 14554 | .input_mux = &alc269_capture_source, |
| 14555 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14556 | [ALC269_QUANTA_FL1] = { |
| 14557 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14558 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14559 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14560 | .dac_nids = alc269_dac_nids, |
| 14561 | .hp_nid = 0x03, |
| 14562 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14563 | .channel_mode = alc269_modes, |
| 14564 | .input_mux = &alc269_capture_source, |
| 14565 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14566 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14567 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14568 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14569 | [ALC269_AMIC] = { |
| 14570 | .mixers = { alc269_laptop_mixer }, |
| 14571 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14572 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14573 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14574 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14575 | .dac_nids = alc269_dac_nids, |
| 14576 | .hp_nid = 0x03, |
| 14577 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14578 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14579 | .unsol_event = alc269_laptop_unsol_event, |
| 14580 | .setup = alc269_laptop_amic_setup, |
| 14581 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14582 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14583 | [ALC269_DMIC] = { |
| 14584 | .mixers = { alc269_laptop_mixer }, |
| 14585 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14586 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14587 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14588 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14589 | .dac_nids = alc269_dac_nids, |
| 14590 | .hp_nid = 0x03, |
| 14591 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14592 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14593 | .unsol_event = alc269_laptop_unsol_event, |
| 14594 | .setup = alc269_laptop_dmic_setup, |
| 14595 | .init_hook = alc269_laptop_inithook, |
| 14596 | }, |
| 14597 | [ALC269VB_AMIC] = { |
| 14598 | .mixers = { alc269vb_laptop_mixer }, |
| 14599 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 14600 | .init_verbs = { alc269vb_init_verbs, |
| 14601 | alc269vb_laptop_amic_init_verbs }, |
| 14602 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14603 | .dac_nids = alc269_dac_nids, |
| 14604 | .hp_nid = 0x03, |
| 14605 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14606 | .channel_mode = alc269_modes, |
| 14607 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14608 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14609 | .init_hook = alc269_laptop_inithook, |
| 14610 | }, |
| 14611 | [ALC269VB_DMIC] = { |
| 14612 | .mixers = { alc269vb_laptop_mixer }, |
| 14613 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14614 | .init_verbs = { alc269vb_init_verbs, |
| 14615 | alc269vb_laptop_dmic_init_verbs }, |
| 14616 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14617 | .dac_nids = alc269_dac_nids, |
| 14618 | .hp_nid = 0x03, |
| 14619 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14620 | .channel_mode = alc269_modes, |
| 14621 | .unsol_event = alc269_laptop_unsol_event, |
| 14622 | .setup = alc269vb_laptop_dmic_setup, |
| 14623 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14624 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14625 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14626 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14627 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14628 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14629 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14630 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14631 | .dac_nids = alc269_dac_nids, |
| 14632 | .hp_nid = 0x03, |
| 14633 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14634 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14635 | .unsol_event = alc269_laptop_unsol_event, |
| 14636 | .setup = alc269_laptop_dmic_setup, |
| 14637 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14638 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14639 | [ALC269_LIFEBOOK] = { |
| 14640 | .mixers = { alc269_lifebook_mixer }, |
| 14641 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 14642 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14643 | .dac_nids = alc269_dac_nids, |
| 14644 | .hp_nid = 0x03, |
| 14645 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14646 | .channel_mode = alc269_modes, |
| 14647 | .input_mux = &alc269_capture_source, |
| 14648 | .unsol_event = alc269_lifebook_unsol_event, |
| 14649 | .init_hook = alc269_lifebook_init_hook, |
| 14650 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14651 | [ALC271_ACER] = { |
| 14652 | .mixers = { alc269_asus_mixer }, |
| 14653 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14654 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 14655 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14656 | .dac_nids = alc269_dac_nids, |
| 14657 | .adc_nids = alc262_dmic_adc_nids, |
| 14658 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 14659 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 14660 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14661 | .channel_mode = alc269_modes, |
| 14662 | .input_mux = &alc269_capture_source, |
| 14663 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 14664 | .unsol_event = alc_sku_unsol_event, |
| 14665 | .setup = alc269vb_laptop_dmic_setup, |
| 14666 | .init_hook = alc_inithook, |
| 14667 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14668 | }; |
| 14669 | |
| 14670 | static int patch_alc269(struct hda_codec *codec) |
| 14671 | { |
| 14672 | struct alc_spec *spec; |
| 14673 | int board_config; |
| 14674 | int err; |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14675 | int is_alc269vb = 0; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14676 | |
| 14677 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14678 | if (spec == NULL) |
| 14679 | return -ENOMEM; |
| 14680 | |
| 14681 | codec->spec = spec; |
| 14682 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14683 | alc_auto_parse_customize_define(codec); |
| 14684 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14685 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14686 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 14687 | spec->cdefine.platform_type == 1) |
| 14688 | alc_codec_rename(codec, "ALC271X"); |
| 14689 | else |
| 14690 | alc_codec_rename(codec, "ALC259"); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14691 | is_alc269vb = 1; |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14692 | } else |
| 14693 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14694 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14695 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 14696 | alc269_models, |
| 14697 | alc269_cfg_tbl); |
| 14698 | |
| 14699 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14700 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14701 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14702 | board_config = ALC269_AUTO; |
| 14703 | } |
| 14704 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14705 | if (board_config == ALC269_AUTO) |
| 14706 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); |
| 14707 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14708 | if (board_config == ALC269_AUTO) { |
| 14709 | /* automatic parse from the BIOS config */ |
| 14710 | err = alc269_parse_auto_config(codec); |
| 14711 | if (err < 0) { |
| 14712 | alc_free(codec); |
| 14713 | return err; |
| 14714 | } else if (!err) { |
| 14715 | printk(KERN_INFO |
| 14716 | "hda_codec: Cannot set up configuration " |
| 14717 | "from BIOS. Using base mode...\n"); |
| 14718 | board_config = ALC269_BASIC; |
| 14719 | } |
| 14720 | } |
| 14721 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 14722 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 14723 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14724 | if (err < 0) { |
| 14725 | alc_free(codec); |
| 14726 | return err; |
| 14727 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14728 | } |
| 14729 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14730 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14731 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14732 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14733 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14734 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 14735 | * fix the sample rate of analog I/O to 44.1kHz |
| 14736 | */ |
| 14737 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 14738 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14739 | } else if (spec->dual_adc_switch) { |
| 14740 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14741 | /* switch ADC dynamically */ |
| 14742 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14743 | } else { |
| 14744 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14745 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 14746 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14747 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 14748 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 14749 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14750 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
| 14751 | if (!is_alc269vb) { |
| 14752 | spec->adc_nids = alc269_adc_nids; |
| 14753 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 14754 | spec->capsrc_nids = alc269_capsrc_nids; |
| 14755 | } else { |
| 14756 | spec->adc_nids = alc269vb_adc_nids; |
| 14757 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 14758 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 14759 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14760 | } |
| 14761 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14762 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14763 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 14764 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14765 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14766 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14767 | if (board_config == ALC269_AUTO) |
| 14768 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); |
| 14769 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 14770 | spec->vmaster_nid = 0x02; |
| 14771 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14772 | codec->patch_ops = alc_patch_ops; |
| 14773 | if (board_config == ALC269_AUTO) |
| 14774 | spec->init_hook = alc269_auto_init; |
| 14775 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14776 | if (!spec->loopback.amplist) |
| 14777 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14778 | if (alc269_mic2_for_mute_led(codec)) |
| 14779 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14780 | #endif |
| 14781 | |
| 14782 | return 0; |
| 14783 | } |
| 14784 | |
| 14785 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14786 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 14787 | */ |
| 14788 | |
| 14789 | /* |
| 14790 | * set the path ways for 2 channel output |
| 14791 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 14792 | */ |
| 14793 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 14794 | /* set pin widget 1Ah (line in) for input */ |
| 14795 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14796 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14797 | * the vref |
| 14798 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14799 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14800 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14801 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14802 | #if 0 |
| 14803 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14804 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14805 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14806 | { } /* end */ |
| 14807 | }; |
| 14808 | /* |
| 14809 | * 6ch mode |
| 14810 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 14811 | */ |
| 14812 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 14813 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14814 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14815 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14816 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14817 | |
| 14818 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14819 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14820 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14821 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14822 | #if 0 |
| 14823 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14824 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14825 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14826 | { } /* end */ |
| 14827 | }; |
| 14828 | |
| 14829 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 14830 | { 2, alc861_threestack_ch2_init }, |
| 14831 | { 6, alc861_threestack_ch6_init }, |
| 14832 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14833 | /* Set mic1 as input and unmute the mixer */ |
| 14834 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 14835 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14836 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14837 | { } /* end */ |
| 14838 | }; |
| 14839 | /* Set mic1 as output and mute mixer */ |
| 14840 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 14841 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14842 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14843 | { } /* end */ |
| 14844 | }; |
| 14845 | |
| 14846 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 14847 | { 2, alc861_uniwill_m31_ch2_init }, |
| 14848 | { 4, alc861_uniwill_m31_ch4_init }, |
| 14849 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14850 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14851 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 14852 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 14853 | /* set pin widget 1Ah (line in) for input */ |
| 14854 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14855 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14856 | * the vref |
| 14857 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14858 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14859 | |
| 14860 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14861 | #if 0 |
| 14862 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14863 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14864 | #endif |
| 14865 | { } /* end */ |
| 14866 | }; |
| 14867 | /* Set mic1 nad line-in as output and mute mixer */ |
| 14868 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 14869 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14870 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14871 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14872 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14873 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14874 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14875 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14876 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14877 | |
| 14878 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14879 | #if 0 |
| 14880 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14881 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14882 | #endif |
| 14883 | { } /* end */ |
| 14884 | }; |
| 14885 | |
| 14886 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 14887 | { 2, alc861_asus_ch2_init }, |
| 14888 | { 6, alc861_asus_ch6_init }, |
| 14889 | }; |
| 14890 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14891 | /* patch-ALC861 */ |
| 14892 | |
| 14893 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 14894 | /* output mixer control */ |
| 14895 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14896 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14897 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14898 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14899 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14900 | |
| 14901 | /*Input mixer control */ |
| 14902 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14903 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14904 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14905 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14906 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14907 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14908 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14909 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14910 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14911 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14912 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14913 | { } /* end */ |
| 14914 | }; |
| 14915 | |
| 14916 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 14917 | /* output mixer control */ |
| 14918 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14919 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14920 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14921 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14922 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14923 | |
| 14924 | /* Input mixer control */ |
| 14925 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14926 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14927 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14928 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14929 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14930 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14931 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14932 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14933 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14934 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14935 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14936 | { |
| 14937 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14938 | .name = "Channel Mode", |
| 14939 | .info = alc_ch_mode_info, |
| 14940 | .get = alc_ch_mode_get, |
| 14941 | .put = alc_ch_mode_put, |
| 14942 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 14943 | }, |
| 14944 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14945 | }; |
| 14946 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14947 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14948 | /* output mixer control */ |
| 14949 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14950 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14951 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14952 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14953 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14954 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14955 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14956 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 14957 | /* output mixer control */ |
| 14958 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14959 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14960 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14961 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14962 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14963 | |
| 14964 | /* Input mixer control */ |
| 14965 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14966 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14967 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14968 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14969 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14970 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14971 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14972 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14973 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14974 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14975 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14976 | { |
| 14977 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14978 | .name = "Channel Mode", |
| 14979 | .info = alc_ch_mode_info, |
| 14980 | .get = alc_ch_mode_get, |
| 14981 | .put = alc_ch_mode_put, |
| 14982 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14983 | }, |
| 14984 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14985 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14986 | |
| 14987 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 14988 | /* output mixer control */ |
| 14989 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14990 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14991 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14992 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14993 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14994 | |
| 14995 | /* Input mixer control */ |
| 14996 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14997 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14998 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14999 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15000 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15001 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15002 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15003 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15004 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15005 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15006 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15007 | { |
| 15008 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15009 | .name = "Channel Mode", |
| 15010 | .info = alc_ch_mode_info, |
| 15011 | .get = alc_ch_mode_get, |
| 15012 | .put = alc_ch_mode_put, |
| 15013 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15014 | }, |
| 15015 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15016 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15017 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15018 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15019 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15020 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15021 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15022 | { } |
| 15023 | }; |
| 15024 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15025 | /* |
| 15026 | * generic initialization of ADC, input mixers and output mixers |
| 15027 | */ |
| 15028 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15029 | /* |
| 15030 | * Unmute ADC0 and set the default input to mic-in |
| 15031 | */ |
| 15032 | /* port-A for surround (rear panel) */ |
| 15033 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15034 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15035 | /* port-B for mic-in (rear panel) with vref */ |
| 15036 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15037 | /* port-C for line-in (rear panel) */ |
| 15038 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15039 | /* port-D for Front */ |
| 15040 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15041 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15042 | /* port-E for HP out (front panel) */ |
| 15043 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15044 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15045 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15046 | /* port-F for mic-in (front panel) with vref */ |
| 15047 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15048 | /* port-G for CLFE (rear panel) */ |
| 15049 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15050 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15051 | /* port-H for side (rear panel) */ |
| 15052 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15053 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15054 | /* CD-in */ |
| 15055 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15056 | /* route front mic to ADC1*/ |
| 15057 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15058 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15059 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15060 | /* Unmute DAC0~3 & spdif out*/ |
| 15061 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15062 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15063 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15064 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15065 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15066 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15067 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15068 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15069 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15070 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15071 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15072 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15073 | /* Unmute Stereo Mixer 15 */ |
| 15074 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15075 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15076 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15077 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15078 | |
| 15079 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15080 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15081 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15082 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15083 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15084 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15085 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15086 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15087 | /* hp used DAC 3 (Front) */ |
| 15088 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15089 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15090 | |
| 15091 | { } |
| 15092 | }; |
| 15093 | |
| 15094 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15095 | /* |
| 15096 | * Unmute ADC0 and set the default input to mic-in |
| 15097 | */ |
| 15098 | /* port-A for surround (rear panel) */ |
| 15099 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15100 | /* port-B for mic-in (rear panel) with vref */ |
| 15101 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15102 | /* port-C for line-in (rear panel) */ |
| 15103 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15104 | /* port-D for Front */ |
| 15105 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15106 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15107 | /* port-E for HP out (front panel) */ |
| 15108 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15109 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15110 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15111 | /* port-F for mic-in (front panel) with vref */ |
| 15112 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15113 | /* port-G for CLFE (rear panel) */ |
| 15114 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15115 | /* port-H for side (rear panel) */ |
| 15116 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15117 | /* CD-in */ |
| 15118 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15119 | /* route front mic to ADC1*/ |
| 15120 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15121 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15122 | /* Unmute DAC0~3 & spdif out*/ |
| 15123 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15124 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15125 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15126 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15127 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15128 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15129 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15130 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15131 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15132 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15133 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15134 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15135 | /* Unmute Stereo Mixer 15 */ |
| 15136 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15137 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15138 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15139 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15140 | |
| 15141 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15142 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15143 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15144 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15145 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15146 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15147 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15148 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15149 | /* hp used DAC 3 (Front) */ |
| 15150 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15151 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15152 | { } |
| 15153 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15154 | |
| 15155 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15156 | /* |
| 15157 | * Unmute ADC0 and set the default input to mic-in |
| 15158 | */ |
| 15159 | /* port-A for surround (rear panel) */ |
| 15160 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15161 | /* port-B for mic-in (rear panel) with vref */ |
| 15162 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15163 | /* port-C for line-in (rear panel) */ |
| 15164 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15165 | /* port-D for Front */ |
| 15166 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15167 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15168 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15169 | /* this has to be set to VREF80 */ |
| 15170 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15171 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15172 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15173 | /* port-F for mic-in (front panel) with vref */ |
| 15174 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15175 | /* port-G for CLFE (rear panel) */ |
| 15176 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15177 | /* port-H for side (rear panel) */ |
| 15178 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15179 | /* CD-in */ |
| 15180 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15181 | /* route front mic to ADC1*/ |
| 15182 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15183 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15184 | /* Unmute DAC0~3 & spdif out*/ |
| 15185 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15186 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15187 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15188 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15189 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15190 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15191 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15192 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15193 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15194 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15195 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15196 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15197 | /* Unmute Stereo Mixer 15 */ |
| 15198 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15199 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15200 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15201 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15202 | |
| 15203 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15204 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15205 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15206 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15207 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15208 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15209 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15210 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15211 | /* hp used DAC 3 (Front) */ |
| 15212 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15213 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15214 | { } |
| 15215 | }; |
| 15216 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15217 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15218 | /* |
| 15219 | * Unmute ADC0 and set the default input to mic-in |
| 15220 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15221 | /* port-A for surround (rear panel) |
| 15222 | * according to codec#0 this is the HP jack |
| 15223 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15224 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15225 | /* route front PCM to HP */ |
| 15226 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15227 | /* port-B for mic-in (rear panel) with vref */ |
| 15228 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15229 | /* port-C for line-in (rear panel) */ |
| 15230 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15231 | /* port-D for Front */ |
| 15232 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15233 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15234 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15235 | /* this has to be set to VREF80 */ |
| 15236 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15237 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15238 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15239 | /* port-F for mic-in (front panel) with vref */ |
| 15240 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15241 | /* port-G for CLFE (rear panel) */ |
| 15242 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15243 | /* port-H for side (rear panel) */ |
| 15244 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15245 | /* CD-in */ |
| 15246 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15247 | /* route front mic to ADC1*/ |
| 15248 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15249 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15250 | /* Unmute DAC0~3 & spdif out*/ |
| 15251 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15252 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15253 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15254 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15255 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15256 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15257 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15258 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15259 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15260 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15261 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15262 | /* Unmute Stereo Mixer 15 */ |
| 15263 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15264 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15265 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15266 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15267 | |
| 15268 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15269 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15270 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15271 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15272 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15273 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15274 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15275 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15276 | /* hp used DAC 3 (Front) */ |
| 15277 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15278 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15279 | { } |
| 15280 | }; |
| 15281 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15282 | /* additional init verbs for ASUS laptops */ |
| 15283 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15284 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15285 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15286 | { } |
| 15287 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15288 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15289 | /* |
| 15290 | * generic initialization of ADC, input mixers and output mixers |
| 15291 | */ |
| 15292 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15293 | /* |
| 15294 | * Unmute ADC0 and set the default input to mic-in |
| 15295 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15296 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15297 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15298 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15299 | /* Unmute DAC0~3 & spdif out*/ |
| 15300 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15301 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15302 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15303 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15304 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15305 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15306 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15307 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15308 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15309 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15310 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15311 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15312 | /* Unmute Stereo Mixer 15 */ |
| 15313 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15314 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15315 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15316 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15317 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15318 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15319 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15320 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15321 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15322 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15323 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15324 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15325 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15326 | |
| 15327 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15328 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15329 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15330 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15331 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15332 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15333 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15334 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15335 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15336 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15337 | |
| 15338 | { } |
| 15339 | }; |
| 15340 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15341 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15342 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15343 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15344 | { } |
| 15345 | }; |
| 15346 | |
| 15347 | /* toggle speaker-output according to the hp-jack state */ |
| 15348 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15349 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15350 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15351 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15352 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15353 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15354 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15355 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15356 | } |
| 15357 | |
| 15358 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15359 | unsigned int res) |
| 15360 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15361 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15362 | alc861_toshiba_automute(codec); |
| 15363 | } |
| 15364 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15365 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15366 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15367 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15368 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15369 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15370 | |
| 15371 | |
| 15372 | #define ALC861_DIGOUT_NID 0x07 |
| 15373 | |
| 15374 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15375 | { 8, NULL } |
| 15376 | }; |
| 15377 | |
| 15378 | static hda_nid_t alc861_dac_nids[4] = { |
| 15379 | /* front, surround, clfe, side */ |
| 15380 | 0x03, 0x06, 0x05, 0x04 |
| 15381 | }; |
| 15382 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15383 | static hda_nid_t alc660_dac_nids[3] = { |
| 15384 | /* front, clfe, surround */ |
| 15385 | 0x03, 0x05, 0x06 |
| 15386 | }; |
| 15387 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15388 | static hda_nid_t alc861_adc_nids[1] = { |
| 15389 | /* ADC0-2 */ |
| 15390 | 0x08, |
| 15391 | }; |
| 15392 | |
| 15393 | static struct hda_input_mux alc861_capture_source = { |
| 15394 | .num_items = 5, |
| 15395 | .items = { |
| 15396 | { "Mic", 0x0 }, |
| 15397 | { "Front Mic", 0x3 }, |
| 15398 | { "Line", 0x1 }, |
| 15399 | { "CD", 0x4 }, |
| 15400 | { "Mixer", 0x5 }, |
| 15401 | }, |
| 15402 | }; |
| 15403 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15404 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15405 | { |
| 15406 | struct alc_spec *spec = codec->spec; |
| 15407 | hda_nid_t mix, srcs[5]; |
| 15408 | int i, j, num; |
| 15409 | |
| 15410 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15411 | return 0; |
| 15412 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15413 | if (num < 0) |
| 15414 | return 0; |
| 15415 | for (i = 0; i < num; i++) { |
| 15416 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15417 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15418 | if (type != AC_WID_AUD_OUT) |
| 15419 | continue; |
| 15420 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15421 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15422 | break; |
| 15423 | if (j >= spec->multiout.num_dacs) |
| 15424 | return srcs[i]; |
| 15425 | } |
| 15426 | return 0; |
| 15427 | } |
| 15428 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15429 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15430 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15431 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15432 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15433 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15434 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15435 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15436 | |
| 15437 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15438 | for (i = 0; i < cfg->line_outs; i++) { |
| 15439 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15440 | dac = alc861_look_for_dac(codec, nid); |
| 15441 | if (!dac) |
| 15442 | continue; |
| 15443 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15444 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15445 | return 0; |
| 15446 | } |
| 15447 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15448 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15449 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15450 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15451 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15452 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15453 | } |
| 15454 | |
| 15455 | /* add playback controls from the parsed DAC table */ |
| 15456 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15457 | const struct auto_pin_cfg *cfg) |
| 15458 | { |
| 15459 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15460 | static const char *chname[4] = { |
| 15461 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15462 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15463 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15464 | int i, err; |
| 15465 | |
| 15466 | if (cfg->line_outs == 1) { |
| 15467 | const char *pfx = NULL; |
| 15468 | if (!cfg->hp_outs) |
| 15469 | pfx = "Master"; |
| 15470 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15471 | pfx = "Speaker"; |
| 15472 | if (pfx) { |
| 15473 | nid = spec->multiout.dac_nids[0]; |
| 15474 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 15475 | } |
| 15476 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15477 | |
| 15478 | for (i = 0; i < cfg->line_outs; i++) { |
| 15479 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15480 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15481 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15482 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15483 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15484 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15485 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15486 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15487 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15488 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15489 | return err; |
| 15490 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15491 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15492 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15493 | return err; |
| 15494 | } |
| 15495 | } |
| 15496 | return 0; |
| 15497 | } |
| 15498 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15499 | 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] | 15500 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15501 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15502 | int err; |
| 15503 | hda_nid_t nid; |
| 15504 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15505 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15506 | return 0; |
| 15507 | |
| 15508 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15509 | nid = alc861_look_for_dac(codec, pin); |
| 15510 | if (nid) { |
| 15511 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15512 | if (err < 0) |
| 15513 | return err; |
| 15514 | spec->multiout.hp_nid = nid; |
| 15515 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15516 | } |
| 15517 | return 0; |
| 15518 | } |
| 15519 | |
| 15520 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15521 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15522 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15523 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15524 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15525 | } |
| 15526 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15527 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15528 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15529 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15530 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15531 | hda_nid_t mix, srcs[5]; |
| 15532 | int i, num; |
| 15533 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15534 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15535 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15536 | 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] | 15537 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15538 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 15539 | return; |
| 15540 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15541 | if (num < 0) |
| 15542 | return; |
| 15543 | for (i = 0; i < num; i++) { |
| 15544 | unsigned int mute; |
| 15545 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 15546 | mute = AMP_IN_UNMUTE(i); |
| 15547 | else |
| 15548 | mute = AMP_IN_MUTE(i); |
| 15549 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15550 | mute); |
| 15551 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15552 | } |
| 15553 | |
| 15554 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 15555 | { |
| 15556 | struct alc_spec *spec = codec->spec; |
| 15557 | int i; |
| 15558 | |
| 15559 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 15560 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15561 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15562 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15563 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15564 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15565 | } |
| 15566 | } |
| 15567 | |
| 15568 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 15569 | { |
| 15570 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15571 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15572 | if (spec->autocfg.hp_outs) |
| 15573 | alc861_auto_set_output_and_unmute(codec, |
| 15574 | spec->autocfg.hp_pins[0], |
| 15575 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15576 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15577 | if (spec->autocfg.speaker_outs) |
| 15578 | alc861_auto_set_output_and_unmute(codec, |
| 15579 | spec->autocfg.speaker_pins[0], |
| 15580 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15581 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15582 | } |
| 15583 | |
| 15584 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 15585 | { |
| 15586 | struct alc_spec *spec = codec->spec; |
| 15587 | int i; |
| 15588 | |
| 15589 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15590 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15591 | if (nid >= 0x0c && nid <= 0x11) |
| 15592 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15593 | } |
| 15594 | } |
| 15595 | |
| 15596 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15597 | /* return 1 if successful, 0 if the proper config is not found, |
| 15598 | * or a negative error code |
| 15599 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15600 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 15601 | { |
| 15602 | struct alc_spec *spec = codec->spec; |
| 15603 | int err; |
| 15604 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 15605 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15606 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15607 | alc861_ignore); |
| 15608 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15609 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15610 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15611 | return 0; /* can't find valid BIOS pin config */ |
| 15612 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15613 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15614 | if (err < 0) |
| 15615 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15616 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15617 | if (err < 0) |
| 15618 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15619 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15620 | if (err < 0) |
| 15621 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15622 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15623 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15624 | return err; |
| 15625 | |
| 15626 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15627 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 15628 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15629 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15630 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15631 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15632 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15633 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15634 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 15635 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15636 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15637 | |
| 15638 | spec->adc_nids = alc861_adc_nids; |
| 15639 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15640 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15641 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 15642 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15643 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15644 | return 1; |
| 15645 | } |
| 15646 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15647 | /* additional initialization for auto-configuration model */ |
| 15648 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15649 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15650 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15651 | alc861_auto_init_multi_out(codec); |
| 15652 | alc861_auto_init_hp_out(codec); |
| 15653 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 15654 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15655 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15656 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15657 | } |
| 15658 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15659 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15660 | static struct hda_amp_list alc861_loopbacks[] = { |
| 15661 | { 0x15, HDA_INPUT, 0 }, |
| 15662 | { 0x15, HDA_INPUT, 1 }, |
| 15663 | { 0x15, HDA_INPUT, 2 }, |
| 15664 | { 0x15, HDA_INPUT, 3 }, |
| 15665 | { } /* end */ |
| 15666 | }; |
| 15667 | #endif |
| 15668 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15669 | |
| 15670 | /* |
| 15671 | * configuration and preset |
| 15672 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15673 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 15674 | [ALC861_3ST] = "3stack", |
| 15675 | [ALC660_3ST] = "3stack-660", |
| 15676 | [ALC861_3ST_DIG] = "3stack-dig", |
| 15677 | [ALC861_6ST_DIG] = "6stack-dig", |
| 15678 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 15679 | [ALC861_TOSHIBA] = "toshiba", |
| 15680 | [ALC861_ASUS] = "asus", |
| 15681 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 15682 | [ALC861_AUTO] = "auto", |
| 15683 | }; |
| 15684 | |
| 15685 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 15686 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15687 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15688 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15689 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15690 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 15691 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 15692 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 15693 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 15694 | * Any other models that need this preset? |
| 15695 | */ |
| 15696 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 15697 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 15698 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15699 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 15700 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 15701 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 15702 | /* FIXME: the below seems conflict */ |
| 15703 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 15704 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 15705 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15706 | {} |
| 15707 | }; |
| 15708 | |
| 15709 | static struct alc_config_preset alc861_presets[] = { |
| 15710 | [ALC861_3ST] = { |
| 15711 | .mixers = { alc861_3ST_mixer }, |
| 15712 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15713 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15714 | .dac_nids = alc861_dac_nids, |
| 15715 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15716 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15717 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15718 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15719 | .adc_nids = alc861_adc_nids, |
| 15720 | .input_mux = &alc861_capture_source, |
| 15721 | }, |
| 15722 | [ALC861_3ST_DIG] = { |
| 15723 | .mixers = { alc861_base_mixer }, |
| 15724 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15725 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15726 | .dac_nids = alc861_dac_nids, |
| 15727 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15728 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15729 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15730 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15731 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15732 | .adc_nids = alc861_adc_nids, |
| 15733 | .input_mux = &alc861_capture_source, |
| 15734 | }, |
| 15735 | [ALC861_6ST_DIG] = { |
| 15736 | .mixers = { alc861_base_mixer }, |
| 15737 | .init_verbs = { alc861_base_init_verbs }, |
| 15738 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15739 | .dac_nids = alc861_dac_nids, |
| 15740 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15741 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 15742 | .channel_mode = alc861_8ch_modes, |
| 15743 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15744 | .adc_nids = alc861_adc_nids, |
| 15745 | .input_mux = &alc861_capture_source, |
| 15746 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15747 | [ALC660_3ST] = { |
| 15748 | .mixers = { alc861_3ST_mixer }, |
| 15749 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15750 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 15751 | .dac_nids = alc660_dac_nids, |
| 15752 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15753 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15754 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15755 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15756 | .adc_nids = alc861_adc_nids, |
| 15757 | .input_mux = &alc861_capture_source, |
| 15758 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15759 | [ALC861_UNIWILL_M31] = { |
| 15760 | .mixers = { alc861_uniwill_m31_mixer }, |
| 15761 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 15762 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15763 | .dac_nids = alc861_dac_nids, |
| 15764 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15765 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15766 | .channel_mode = alc861_uniwill_m31_modes, |
| 15767 | .need_dac_fix = 1, |
| 15768 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15769 | .adc_nids = alc861_adc_nids, |
| 15770 | .input_mux = &alc861_capture_source, |
| 15771 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15772 | [ALC861_TOSHIBA] = { |
| 15773 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15774 | .init_verbs = { alc861_base_init_verbs, |
| 15775 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15776 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15777 | .dac_nids = alc861_dac_nids, |
| 15778 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15779 | .channel_mode = alc883_3ST_2ch_modes, |
| 15780 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15781 | .adc_nids = alc861_adc_nids, |
| 15782 | .input_mux = &alc861_capture_source, |
| 15783 | .unsol_event = alc861_toshiba_unsol_event, |
| 15784 | .init_hook = alc861_toshiba_automute, |
| 15785 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15786 | [ALC861_ASUS] = { |
| 15787 | .mixers = { alc861_asus_mixer }, |
| 15788 | .init_verbs = { alc861_asus_init_verbs }, |
| 15789 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15790 | .dac_nids = alc861_dac_nids, |
| 15791 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15792 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 15793 | .channel_mode = alc861_asus_modes, |
| 15794 | .need_dac_fix = 1, |
| 15795 | .hp_nid = 0x06, |
| 15796 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15797 | .adc_nids = alc861_adc_nids, |
| 15798 | .input_mux = &alc861_capture_source, |
| 15799 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15800 | [ALC861_ASUS_LAPTOP] = { |
| 15801 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 15802 | .init_verbs = { alc861_asus_init_verbs, |
| 15803 | alc861_asus_laptop_init_verbs }, |
| 15804 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15805 | .dac_nids = alc861_dac_nids, |
| 15806 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15807 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15808 | .channel_mode = alc883_3ST_2ch_modes, |
| 15809 | .need_dac_fix = 1, |
| 15810 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15811 | .adc_nids = alc861_adc_nids, |
| 15812 | .input_mux = &alc861_capture_source, |
| 15813 | }, |
| 15814 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15815 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15816 | /* Pin config fixes */ |
| 15817 | enum { |
| 15818 | PINFIX_FSC_AMILO_PI1505, |
| 15819 | }; |
| 15820 | |
| 15821 | static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = { |
| 15822 | { 0x0b, 0x0221101f }, /* HP */ |
| 15823 | { 0x0f, 0x90170310 }, /* speaker */ |
| 15824 | { } |
| 15825 | }; |
| 15826 | |
| 15827 | static const struct alc_fixup alc861_fixups[] = { |
| 15828 | [PINFIX_FSC_AMILO_PI1505] = { |
| 15829 | .pins = alc861_fsc_amilo_pi1505_pinfix |
| 15830 | }, |
| 15831 | }; |
| 15832 | |
| 15833 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 15834 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 15835 | {} |
| 15836 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15837 | |
| 15838 | static int patch_alc861(struct hda_codec *codec) |
| 15839 | { |
| 15840 | struct alc_spec *spec; |
| 15841 | int board_config; |
| 15842 | int err; |
| 15843 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 15844 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15845 | if (spec == NULL) |
| 15846 | return -ENOMEM; |
| 15847 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15848 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15849 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15850 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 15851 | alc861_models, |
| 15852 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15853 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15854 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15855 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15856 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15857 | board_config = ALC861_AUTO; |
| 15858 | } |
| 15859 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 15860 | if (board_config == ALC861_AUTO) |
| 15861 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15862 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15863 | if (board_config == ALC861_AUTO) { |
| 15864 | /* automatic parse from the BIOS config */ |
| 15865 | err = alc861_parse_auto_config(codec); |
| 15866 | if (err < 0) { |
| 15867 | alc_free(codec); |
| 15868 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15869 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15870 | printk(KERN_INFO |
| 15871 | "hda_codec: Cannot set up configuration " |
| 15872 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15873 | board_config = ALC861_3ST_DIG; |
| 15874 | } |
| 15875 | } |
| 15876 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15877 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15878 | if (err < 0) { |
| 15879 | alc_free(codec); |
| 15880 | return err; |
| 15881 | } |
| 15882 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15883 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15884 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15885 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15886 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 15887 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 15888 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15889 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 15890 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 15891 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 15892 | if (!spec->cap_mixer) |
| 15893 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15894 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 15895 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15896 | spec->vmaster_nid = 0x03; |
| 15897 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 15898 | if (board_config == ALC861_AUTO) |
| 15899 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); |
| 15900 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15901 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15902 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15903 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15904 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15905 | spec->power_hook = alc_power_eapd; |
| 15906 | #endif |
| 15907 | } |
| 15908 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15909 | if (!spec->loopback.amplist) |
| 15910 | spec->loopback.amplist = alc861_loopbacks; |
| 15911 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15912 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15913 | return 0; |
| 15914 | } |
| 15915 | |
| 15916 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15917 | * ALC861-VD support |
| 15918 | * |
| 15919 | * Based on ALC882 |
| 15920 | * |
| 15921 | * In addition, an independent DAC |
| 15922 | */ |
| 15923 | #define ALC861VD_DIGOUT_NID 0x06 |
| 15924 | |
| 15925 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 15926 | /* front, surr, clfe, side surr */ |
| 15927 | 0x02, 0x03, 0x04, 0x05 |
| 15928 | }; |
| 15929 | |
| 15930 | /* dac_nids for ALC660vd are in a different order - according to |
| 15931 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15932 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15933 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 15934 | * - and it is the same as in 861vd. |
| 15935 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 15936 | */ |
| 15937 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 15938 | /* front, rear, clfe, rear_surr */ |
| 15939 | 0x02, 0x04, 0x03 |
| 15940 | }; |
| 15941 | |
| 15942 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 15943 | /* ADC0 */ |
| 15944 | 0x09, |
| 15945 | }; |
| 15946 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15947 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 15948 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15949 | /* input MUX */ |
| 15950 | /* FIXME: should be a matrix-type input source selection */ |
| 15951 | static struct hda_input_mux alc861vd_capture_source = { |
| 15952 | .num_items = 4, |
| 15953 | .items = { |
| 15954 | { "Mic", 0x0 }, |
| 15955 | { "Front Mic", 0x1 }, |
| 15956 | { "Line", 0x2 }, |
| 15957 | { "CD", 0x4 }, |
| 15958 | }, |
| 15959 | }; |
| 15960 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15961 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15962 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15963 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15964 | { "Ext Mic", 0x0 }, |
| 15965 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15966 | }, |
| 15967 | }; |
| 15968 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15969 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 15970 | .num_items = 2, |
| 15971 | .items = { |
| 15972 | { "Front Mic", 0x0 }, |
| 15973 | { "ATAPI Mic", 0x1 }, |
| 15974 | }, |
| 15975 | }; |
| 15976 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15977 | /* |
| 15978 | * 2ch mode |
| 15979 | */ |
| 15980 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 15981 | { 2, NULL } |
| 15982 | }; |
| 15983 | |
| 15984 | /* |
| 15985 | * 6ch mode |
| 15986 | */ |
| 15987 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 15988 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15989 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15990 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15991 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15992 | { } /* end */ |
| 15993 | }; |
| 15994 | |
| 15995 | /* |
| 15996 | * 8ch mode |
| 15997 | */ |
| 15998 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 15999 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16000 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16001 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16002 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16003 | { } /* end */ |
| 16004 | }; |
| 16005 | |
| 16006 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 16007 | { 6, alc861vd_6stack_ch6_init }, |
| 16008 | { 8, alc861vd_6stack_ch8_init }, |
| 16009 | }; |
| 16010 | |
| 16011 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16012 | { |
| 16013 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16014 | .name = "Channel Mode", |
| 16015 | .info = alc_ch_mode_info, |
| 16016 | .get = alc_ch_mode_get, |
| 16017 | .put = alc_ch_mode_put, |
| 16018 | }, |
| 16019 | { } /* end */ |
| 16020 | }; |
| 16021 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16022 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16023 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16024 | */ |
| 16025 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16026 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16027 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16028 | |
| 16029 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16030 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16031 | |
| 16032 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16033 | HDA_OUTPUT), |
| 16034 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16035 | HDA_OUTPUT), |
| 16036 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16037 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16038 | |
| 16039 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16040 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16041 | |
| 16042 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16043 | |
| 16044 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16045 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16046 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16047 | |
| 16048 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16049 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16050 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16051 | |
| 16052 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16053 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16054 | |
| 16055 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16056 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16057 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16058 | { } /* end */ |
| 16059 | }; |
| 16060 | |
| 16061 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16062 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16063 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16064 | |
| 16065 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16066 | |
| 16067 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16068 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16069 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16070 | |
| 16071 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16072 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16073 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16074 | |
| 16075 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16076 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16077 | |
| 16078 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16079 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16080 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16081 | { } /* end */ |
| 16082 | }; |
| 16083 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16084 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16085 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16086 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16087 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16088 | |
| 16089 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16090 | |
| 16091 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16092 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16093 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16094 | |
| 16095 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16096 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16097 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16098 | |
| 16099 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16100 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16101 | |
| 16102 | { } /* end */ |
| 16103 | }; |
| 16104 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16105 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 16106 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16107 | */ |
| 16108 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16109 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16110 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16111 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16112 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16113 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16114 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16115 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16116 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16117 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16118 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16119 | { } /* end */ |
| 16120 | }; |
| 16121 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16122 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16123 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16124 | */ |
| 16125 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16126 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16127 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16128 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16129 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16130 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16131 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16132 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16133 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16134 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16135 | { } /* end */ |
| 16136 | }; |
| 16137 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16138 | /* |
| 16139 | * generic initialization of ADC, input mixers and output mixers |
| 16140 | */ |
| 16141 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16142 | /* |
| 16143 | * Unmute ADC0 and set the default input to mic-in |
| 16144 | */ |
| 16145 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16146 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16147 | |
| 16148 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16149 | * the analog-loopback mixer widget |
| 16150 | */ |
| 16151 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16152 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16153 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16154 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16155 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16156 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16157 | |
| 16158 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16159 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16160 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16161 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16162 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16163 | |
| 16164 | /* |
| 16165 | * Set up output mixers (0x02 - 0x05) |
| 16166 | */ |
| 16167 | /* set vol=0 to output mixers */ |
| 16168 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16169 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16170 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16171 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16172 | |
| 16173 | /* set up input amps for analog loopback */ |
| 16174 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16175 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16176 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16177 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16178 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16179 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16180 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16181 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16182 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16183 | |
| 16184 | { } |
| 16185 | }; |
| 16186 | |
| 16187 | /* |
| 16188 | * 3-stack pin configuration: |
| 16189 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16190 | */ |
| 16191 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16192 | /* |
| 16193 | * Set pin mode and muting |
| 16194 | */ |
| 16195 | /* set front pin widgets 0x14 for output */ |
| 16196 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16197 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16198 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16199 | |
| 16200 | /* Mic (rear) pin: input vref at 80% */ |
| 16201 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16202 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16203 | /* Front Mic pin: input vref at 80% */ |
| 16204 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16205 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16206 | /* Line In pin: input */ |
| 16207 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16208 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16209 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16210 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16211 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16212 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16213 | /* CD pin widget for input */ |
| 16214 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16215 | |
| 16216 | { } |
| 16217 | }; |
| 16218 | |
| 16219 | /* |
| 16220 | * 6-stack pin configuration: |
| 16221 | */ |
| 16222 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16223 | /* |
| 16224 | * Set pin mode and muting |
| 16225 | */ |
| 16226 | /* set front pin widgets 0x14 for output */ |
| 16227 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16228 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16229 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16230 | |
| 16231 | /* Rear Pin: output 1 (0x0d) */ |
| 16232 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16233 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16234 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16235 | /* CLFE Pin: output 2 (0x0e) */ |
| 16236 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16237 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16238 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16239 | /* Side Pin: output 3 (0x0f) */ |
| 16240 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16241 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16242 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16243 | |
| 16244 | /* Mic (rear) pin: input vref at 80% */ |
| 16245 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16246 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16247 | /* Front Mic pin: input vref at 80% */ |
| 16248 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16249 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16250 | /* Line In pin: input */ |
| 16251 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16252 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16253 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16254 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16255 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16256 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16257 | /* CD pin widget for input */ |
| 16258 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16259 | |
| 16260 | { } |
| 16261 | }; |
| 16262 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16263 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16264 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16265 | { } |
| 16266 | }; |
| 16267 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16268 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16269 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16270 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16271 | { } |
| 16272 | }; |
| 16273 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16274 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16275 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16276 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16277 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16278 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16279 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16280 | {} |
| 16281 | }; |
| 16282 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16283 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 16284 | { |
| 16285 | unsigned int present; |
| 16286 | unsigned char bits; |
| 16287 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16288 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16289 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16290 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16291 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 16292 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16293 | } |
| 16294 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16295 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16296 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16297 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16298 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16299 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16300 | } |
| 16301 | |
| 16302 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16303 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16304 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16305 | alc861vd_lenovo_mic_automute(codec); |
| 16306 | } |
| 16307 | |
| 16308 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16309 | unsigned int res) |
| 16310 | { |
| 16311 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16312 | case ALC880_MIC_EVENT: |
| 16313 | alc861vd_lenovo_mic_automute(codec); |
| 16314 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16315 | default: |
| 16316 | alc_automute_amp_unsol_event(codec, res); |
| 16317 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16318 | } |
| 16319 | } |
| 16320 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16321 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16322 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16323 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16324 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16325 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16326 | |
| 16327 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16328 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16329 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16330 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16331 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16332 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16333 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16334 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16335 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16336 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16337 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16338 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16339 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16340 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16341 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16342 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16343 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16344 | |
| 16345 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16346 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16347 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16348 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16349 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16350 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16351 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16352 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16353 | |
| 16354 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16355 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16356 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16357 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16358 | |
| 16359 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16360 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16361 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16362 | |
| 16363 | { } /* end */ |
| 16364 | }; |
| 16365 | |
| 16366 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16367 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16368 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16369 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16370 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16371 | spec->autocfg.hp_pins[0] = 0x15; |
| 16372 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16373 | } |
| 16374 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16375 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16376 | #define alc861vd_loopbacks alc880_loopbacks |
| 16377 | #endif |
| 16378 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16379 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16380 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16381 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16382 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16383 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16384 | |
| 16385 | /* |
| 16386 | * configuration and preset |
| 16387 | */ |
| 16388 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 16389 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16390 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16391 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16392 | [ALC861VD_3ST] = "3stack", |
| 16393 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16394 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16395 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16396 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16397 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16398 | [ALC861VD_AUTO] = "auto", |
| 16399 | }; |
| 16400 | |
| 16401 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16402 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16403 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16404 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16405 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16406 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16407 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16408 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16409 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16410 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16411 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16412 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16413 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16414 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16415 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16416 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16417 | {} |
| 16418 | }; |
| 16419 | |
| 16420 | static struct alc_config_preset alc861vd_presets[] = { |
| 16421 | [ALC660VD_3ST] = { |
| 16422 | .mixers = { alc861vd_3st_mixer }, |
| 16423 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16424 | alc861vd_3stack_init_verbs }, |
| 16425 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16426 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16427 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16428 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16429 | .input_mux = &alc861vd_capture_source, |
| 16430 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16431 | [ALC660VD_3ST_DIG] = { |
| 16432 | .mixers = { alc861vd_3st_mixer }, |
| 16433 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16434 | alc861vd_3stack_init_verbs }, |
| 16435 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16436 | .dac_nids = alc660vd_dac_nids, |
| 16437 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16438 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16439 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16440 | .input_mux = &alc861vd_capture_source, |
| 16441 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16442 | [ALC861VD_3ST] = { |
| 16443 | .mixers = { alc861vd_3st_mixer }, |
| 16444 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16445 | alc861vd_3stack_init_verbs }, |
| 16446 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16447 | .dac_nids = alc861vd_dac_nids, |
| 16448 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16449 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16450 | .input_mux = &alc861vd_capture_source, |
| 16451 | }, |
| 16452 | [ALC861VD_3ST_DIG] = { |
| 16453 | .mixers = { alc861vd_3st_mixer }, |
| 16454 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16455 | alc861vd_3stack_init_verbs }, |
| 16456 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16457 | .dac_nids = alc861vd_dac_nids, |
| 16458 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16459 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16460 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16461 | .input_mux = &alc861vd_capture_source, |
| 16462 | }, |
| 16463 | [ALC861VD_6ST_DIG] = { |
| 16464 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16465 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16466 | alc861vd_6stack_init_verbs }, |
| 16467 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16468 | .dac_nids = alc861vd_dac_nids, |
| 16469 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16470 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16471 | .channel_mode = alc861vd_6stack_modes, |
| 16472 | .input_mux = &alc861vd_capture_source, |
| 16473 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16474 | [ALC861VD_LENOVO] = { |
| 16475 | .mixers = { alc861vd_lenovo_mixer }, |
| 16476 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16477 | alc861vd_3stack_init_verbs, |
| 16478 | alc861vd_eapd_verbs, |
| 16479 | alc861vd_lenovo_unsol_verbs }, |
| 16480 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16481 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16482 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16483 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16484 | .input_mux = &alc861vd_capture_source, |
| 16485 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16486 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16487 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16488 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16489 | [ALC861VD_DALLAS] = { |
| 16490 | .mixers = { alc861vd_dallas_mixer }, |
| 16491 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16492 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16493 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16494 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16495 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16496 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16497 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16498 | .setup = alc861vd_dallas_setup, |
| 16499 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16500 | }, |
| 16501 | [ALC861VD_HP] = { |
| 16502 | .mixers = { alc861vd_hp_mixer }, |
| 16503 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16504 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16505 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16506 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16507 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16508 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16509 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16510 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16511 | .setup = alc861vd_dallas_setup, |
| 16512 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16513 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16514 | [ALC660VD_ASUS_V1S] = { |
| 16515 | .mixers = { alc861vd_lenovo_mixer }, |
| 16516 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16517 | alc861vd_3stack_init_verbs, |
| 16518 | alc861vd_eapd_verbs, |
| 16519 | alc861vd_lenovo_unsol_verbs }, |
| 16520 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16521 | .dac_nids = alc660vd_dac_nids, |
| 16522 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16523 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16524 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16525 | .input_mux = &alc861vd_capture_source, |
| 16526 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16527 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16528 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16529 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16530 | }; |
| 16531 | |
| 16532 | /* |
| 16533 | * BIOS auto configuration |
| 16534 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16535 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 16536 | const struct auto_pin_cfg *cfg) |
| 16537 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16538 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16539 | } |
| 16540 | |
| 16541 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16542 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16543 | hda_nid_t nid, int pin_type, int dac_idx) |
| 16544 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16545 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16546 | } |
| 16547 | |
| 16548 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 16549 | { |
| 16550 | struct alc_spec *spec = codec->spec; |
| 16551 | int i; |
| 16552 | |
| 16553 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16554 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16555 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16556 | if (nid) |
| 16557 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16558 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16559 | } |
| 16560 | } |
| 16561 | |
| 16562 | |
| 16563 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 16564 | { |
| 16565 | struct alc_spec *spec = codec->spec; |
| 16566 | hda_nid_t pin; |
| 16567 | |
| 16568 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16569 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16570 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16571 | pin = spec->autocfg.speaker_pins[0]; |
| 16572 | if (pin) |
| 16573 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16574 | } |
| 16575 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16576 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 16577 | |
| 16578 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 16579 | { |
| 16580 | struct alc_spec *spec = codec->spec; |
| 16581 | int i; |
| 16582 | |
| 16583 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16584 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16585 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16586 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 16587 | if (nid != ALC861VD_PIN_CD_NID && |
| 16588 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16589 | snd_hda_codec_write(codec, nid, 0, |
| 16590 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16591 | AMP_OUT_MUTE); |
| 16592 | } |
| 16593 | } |
| 16594 | } |
| 16595 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16596 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 16597 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16598 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 16599 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 16600 | |
| 16601 | /* add playback controls from the parsed DAC table */ |
| 16602 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16603 | * different NIDs for mute/unmute switch and volume control */ |
| 16604 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16605 | const struct auto_pin_cfg *cfg) |
| 16606 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16607 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 16608 | hda_nid_t nid_v, nid_s; |
| 16609 | int i, err; |
| 16610 | |
| 16611 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16612 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16613 | continue; |
| 16614 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16615 | alc880_dac_to_idx( |
| 16616 | spec->multiout.dac_nids[i])); |
| 16617 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16618 | alc880_dac_to_idx( |
| 16619 | spec->multiout.dac_nids[i])); |
| 16620 | |
| 16621 | if (i == 2) { |
| 16622 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16623 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16624 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16625 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 16626 | HDA_OUTPUT)); |
| 16627 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16628 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16629 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16630 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16631 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 16632 | HDA_OUTPUT)); |
| 16633 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16634 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16635 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16636 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16637 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 16638 | HDA_INPUT)); |
| 16639 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16640 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16641 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16642 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16643 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 16644 | HDA_INPUT)); |
| 16645 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16646 | return err; |
| 16647 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16648 | const char *pfx; |
| 16649 | if (cfg->line_outs == 1 && |
| 16650 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 16651 | if (!cfg->hp_pins) |
| 16652 | pfx = "Speaker"; |
| 16653 | else |
| 16654 | pfx = "PCM"; |
| 16655 | } else |
| 16656 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16657 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16658 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 16659 | HDA_OUTPUT)); |
| 16660 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16661 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16662 | if (cfg->line_outs == 1 && |
| 16663 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 16664 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16665 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16666 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16667 | HDA_INPUT)); |
| 16668 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16669 | return err; |
| 16670 | } |
| 16671 | } |
| 16672 | return 0; |
| 16673 | } |
| 16674 | |
| 16675 | /* add playback controls for speaker and HP outputs */ |
| 16676 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16677 | * different NIDs for mute/unmute switch and volume control */ |
| 16678 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 16679 | hda_nid_t pin, const char *pfx) |
| 16680 | { |
| 16681 | hda_nid_t nid_v, nid_s; |
| 16682 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16683 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16684 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16685 | return 0; |
| 16686 | |
| 16687 | if (alc880_is_fixed_pin(pin)) { |
| 16688 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16689 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16690 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16691 | spec->multiout.hp_nid = nid_v; |
| 16692 | else |
| 16693 | spec->multiout.extra_out_nid[0] = nid_v; |
| 16694 | /* control HP volume/switch on the output mixer amp */ |
| 16695 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16696 | alc880_fixed_pin_idx(pin)); |
| 16697 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16698 | alc880_fixed_pin_idx(pin)); |
| 16699 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16700 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16701 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 16702 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16703 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16704 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16705 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 16706 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16707 | return err; |
| 16708 | } else if (alc880_is_multi_pin(pin)) { |
| 16709 | /* set manual connection */ |
| 16710 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16711 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16712 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16713 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16714 | return err; |
| 16715 | } |
| 16716 | return 0; |
| 16717 | } |
| 16718 | |
| 16719 | /* parse the BIOS configuration and set up the alc_spec |
| 16720 | * return 1 if successful, 0 if the proper config is not found, |
| 16721 | * or a negative error code |
| 16722 | * Based on ALC880 version - had to change it to override |
| 16723 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 16724 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 16725 | { |
| 16726 | struct alc_spec *spec = codec->spec; |
| 16727 | int err; |
| 16728 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 16729 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16730 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16731 | alc861vd_ignore); |
| 16732 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16733 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16734 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16735 | return 0; /* can't find valid BIOS pin config */ |
| 16736 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16737 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16738 | if (err < 0) |
| 16739 | return err; |
| 16740 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16741 | if (err < 0) |
| 16742 | return err; |
| 16743 | err = alc861vd_auto_create_extra_out(spec, |
| 16744 | spec->autocfg.speaker_pins[0], |
| 16745 | "Speaker"); |
| 16746 | if (err < 0) |
| 16747 | return err; |
| 16748 | err = alc861vd_auto_create_extra_out(spec, |
| 16749 | spec->autocfg.hp_pins[0], |
| 16750 | "Headphone"); |
| 16751 | if (err < 0) |
| 16752 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16753 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16754 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16755 | return err; |
| 16756 | |
| 16757 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16758 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16759 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16760 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16761 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16762 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16763 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16764 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16765 | |
| 16766 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16767 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16768 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 16769 | err = alc_auto_add_mic_boost(codec); |
| 16770 | if (err < 0) |
| 16771 | return err; |
| 16772 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16773 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16774 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16775 | return 1; |
| 16776 | } |
| 16777 | |
| 16778 | /* additional initialization for auto-configuration model */ |
| 16779 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 16780 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16781 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16782 | alc861vd_auto_init_multi_out(codec); |
| 16783 | alc861vd_auto_init_hp_out(codec); |
| 16784 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16785 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16786 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16787 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16788 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16789 | } |
| 16790 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16791 | enum { |
| 16792 | ALC660VD_FIX_ASUS_GPIO1 |
| 16793 | }; |
| 16794 | |
| 16795 | /* reset GPIO1 */ |
| 16796 | static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = { |
| 16797 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 16798 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 16799 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 16800 | { } |
| 16801 | }; |
| 16802 | |
| 16803 | static const struct alc_fixup alc861vd_fixups[] = { |
| 16804 | [ALC660VD_FIX_ASUS_GPIO1] = { |
| 16805 | .verbs = alc660vd_fix_asus_gpio1_verbs, |
| 16806 | }, |
| 16807 | }; |
| 16808 | |
| 16809 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 16810 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 16811 | {} |
| 16812 | }; |
| 16813 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16814 | static int patch_alc861vd(struct hda_codec *codec) |
| 16815 | { |
| 16816 | struct alc_spec *spec; |
| 16817 | int err, board_config; |
| 16818 | |
| 16819 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16820 | if (spec == NULL) |
| 16821 | return -ENOMEM; |
| 16822 | |
| 16823 | codec->spec = spec; |
| 16824 | |
| 16825 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 16826 | alc861vd_models, |
| 16827 | alc861vd_cfg_tbl); |
| 16828 | |
| 16829 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16830 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16831 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16832 | board_config = ALC861VD_AUTO; |
| 16833 | } |
| 16834 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16835 | if (board_config == ALC861VD_AUTO) |
| 16836 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16837 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16838 | if (board_config == ALC861VD_AUTO) { |
| 16839 | /* automatic parse from the BIOS config */ |
| 16840 | err = alc861vd_parse_auto_config(codec); |
| 16841 | if (err < 0) { |
| 16842 | alc_free(codec); |
| 16843 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16844 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16845 | printk(KERN_INFO |
| 16846 | "hda_codec: Cannot set up configuration " |
| 16847 | "from BIOS. Using base mode...\n"); |
| 16848 | board_config = ALC861VD_3ST; |
| 16849 | } |
| 16850 | } |
| 16851 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16852 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16853 | if (err < 0) { |
| 16854 | alc_free(codec); |
| 16855 | return err; |
| 16856 | } |
| 16857 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16858 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16859 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16860 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16861 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16862 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16863 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16864 | } |
| 16865 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16866 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 16867 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 16868 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16869 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 16870 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 16871 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 16872 | if (!spec->adc_nids) { |
| 16873 | spec->adc_nids = alc861vd_adc_nids; |
| 16874 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 16875 | } |
| 16876 | if (!spec->capsrc_nids) |
| 16877 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16878 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16879 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16880 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16881 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16882 | spec->vmaster_nid = 0x02; |
| 16883 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16884 | if (board_config == ALC861VD_AUTO) |
| 16885 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); |
| 16886 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16887 | codec->patch_ops = alc_patch_ops; |
| 16888 | |
| 16889 | if (board_config == ALC861VD_AUTO) |
| 16890 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16891 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16892 | if (!spec->loopback.amplist) |
| 16893 | spec->loopback.amplist = alc861vd_loopbacks; |
| 16894 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16895 | |
| 16896 | return 0; |
| 16897 | } |
| 16898 | |
| 16899 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16900 | * ALC662 support |
| 16901 | * |
| 16902 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 16903 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 16904 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 16905 | * 6-channel independent captures. |
| 16906 | * |
| 16907 | * In addition, an independent DAC for the multi-playback (not used in this |
| 16908 | * driver yet). |
| 16909 | */ |
| 16910 | #define ALC662_DIGOUT_NID 0x06 |
| 16911 | #define ALC662_DIGIN_NID 0x0a |
| 16912 | |
| 16913 | static hda_nid_t alc662_dac_nids[4] = { |
| 16914 | /* front, rear, clfe, rear_surr */ |
| 16915 | 0x02, 0x03, 0x04 |
| 16916 | }; |
| 16917 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16918 | static hda_nid_t alc272_dac_nids[2] = { |
| 16919 | 0x02, 0x03 |
| 16920 | }; |
| 16921 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16922 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16923 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16924 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16925 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16926 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16927 | static hda_nid_t alc272_adc_nids[1] = { |
| 16928 | /* ADC1-2 */ |
| 16929 | 0x08, |
| 16930 | }; |
| 16931 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16932 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16933 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 16934 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16935 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16936 | /* input MUX */ |
| 16937 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16938 | static struct hda_input_mux alc662_capture_source = { |
| 16939 | .num_items = 4, |
| 16940 | .items = { |
| 16941 | { "Mic", 0x0 }, |
| 16942 | { "Front Mic", 0x1 }, |
| 16943 | { "Line", 0x2 }, |
| 16944 | { "CD", 0x4 }, |
| 16945 | }, |
| 16946 | }; |
| 16947 | |
| 16948 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 16949 | .num_items = 2, |
| 16950 | .items = { |
| 16951 | { "Mic", 0x1 }, |
| 16952 | { "Line", 0x2 }, |
| 16953 | }, |
| 16954 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16955 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16956 | static struct hda_input_mux alc663_capture_source = { |
| 16957 | .num_items = 3, |
| 16958 | .items = { |
| 16959 | { "Mic", 0x0 }, |
| 16960 | { "Front Mic", 0x1 }, |
| 16961 | { "Line", 0x2 }, |
| 16962 | }, |
| 16963 | }; |
| 16964 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16965 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16966 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 16967 | .num_items = 16, |
| 16968 | .items = { |
| 16969 | { "Autoselect Mic", 0x0 }, |
| 16970 | { "Internal Mic", 0x1 }, |
| 16971 | { "In-0x02", 0x2 }, |
| 16972 | { "In-0x03", 0x3 }, |
| 16973 | { "In-0x04", 0x4 }, |
| 16974 | { "In-0x05", 0x5 }, |
| 16975 | { "In-0x06", 0x6 }, |
| 16976 | { "In-0x07", 0x7 }, |
| 16977 | { "In-0x08", 0x8 }, |
| 16978 | { "In-0x09", 0x9 }, |
| 16979 | { "In-0x0a", 0x0a }, |
| 16980 | { "In-0x0b", 0x0b }, |
| 16981 | { "In-0x0c", 0x0c }, |
| 16982 | { "In-0x0d", 0x0d }, |
| 16983 | { "In-0x0e", 0x0e }, |
| 16984 | { "In-0x0f", 0x0f }, |
| 16985 | }, |
| 16986 | }; |
| 16987 | #endif |
| 16988 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16989 | /* |
| 16990 | * 2ch mode |
| 16991 | */ |
| 16992 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 16993 | { 2, NULL } |
| 16994 | }; |
| 16995 | |
| 16996 | /* |
| 16997 | * 2ch mode |
| 16998 | */ |
| 16999 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 17000 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17001 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17002 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17003 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17004 | { } /* end */ |
| 17005 | }; |
| 17006 | |
| 17007 | /* |
| 17008 | * 6ch mode |
| 17009 | */ |
| 17010 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17011 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17012 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17013 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17014 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17015 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17016 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17017 | { } /* end */ |
| 17018 | }; |
| 17019 | |
| 17020 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17021 | { 2, alc662_3ST_ch2_init }, |
| 17022 | { 6, alc662_3ST_ch6_init }, |
| 17023 | }; |
| 17024 | |
| 17025 | /* |
| 17026 | * 2ch mode |
| 17027 | */ |
| 17028 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17029 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17030 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17031 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17032 | { } /* end */ |
| 17033 | }; |
| 17034 | |
| 17035 | /* |
| 17036 | * 6ch mode |
| 17037 | */ |
| 17038 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17039 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17040 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17041 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17042 | { } /* end */ |
| 17043 | }; |
| 17044 | |
| 17045 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17046 | { 2, alc662_sixstack_ch6_init }, |
| 17047 | { 6, alc662_sixstack_ch8_init }, |
| 17048 | }; |
| 17049 | |
| 17050 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17051 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17052 | */ |
| 17053 | |
| 17054 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17055 | /* output mixer control */ |
| 17056 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17057 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17058 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17059 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17060 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17061 | 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] | 17062 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17063 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17064 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17065 | |
| 17066 | /*Input mixer control */ |
| 17067 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17068 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17069 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17070 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17071 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17072 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17073 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17074 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17075 | { } /* end */ |
| 17076 | }; |
| 17077 | |
| 17078 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17079 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17080 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17081 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17082 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17083 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17084 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17085 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17086 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17087 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17088 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17089 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17090 | { } /* end */ |
| 17091 | }; |
| 17092 | |
| 17093 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17094 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17095 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17096 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17097 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17098 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17099 | 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] | 17100 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17101 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17102 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17103 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17104 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17105 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17106 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17107 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17108 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17109 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17110 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17111 | { } /* end */ |
| 17112 | }; |
| 17113 | |
| 17114 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17115 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17116 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17117 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17118 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17119 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17120 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17121 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17122 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17123 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17124 | { } /* end */ |
| 17125 | }; |
| 17126 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17127 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17128 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17129 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17130 | |
| 17131 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 17132 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17133 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17134 | |
| 17135 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17136 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17137 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17138 | { } /* end */ |
| 17139 | }; |
| 17140 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17141 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17142 | ALC262_HIPPO_MASTER_SWITCH, |
| 17143 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17144 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17145 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17146 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17147 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17148 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17149 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17150 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17151 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17152 | { } /* end */ |
| 17153 | }; |
| 17154 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17155 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17156 | .ops = &snd_hda_bind_vol, |
| 17157 | .values = { |
| 17158 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17159 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17160 | 0 |
| 17161 | }, |
| 17162 | }; |
| 17163 | |
| 17164 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17165 | .ops = &snd_hda_bind_sw, |
| 17166 | .values = { |
| 17167 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17168 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17169 | 0 |
| 17170 | }, |
| 17171 | }; |
| 17172 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17173 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17174 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17175 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17176 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17177 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17178 | { } /* end */ |
| 17179 | }; |
| 17180 | |
| 17181 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17182 | .ops = &snd_hda_bind_sw, |
| 17183 | .values = { |
| 17184 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17185 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17186 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17187 | 0 |
| 17188 | }, |
| 17189 | }; |
| 17190 | |
| 17191 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17192 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17193 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17194 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17195 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17196 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17197 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17198 | |
| 17199 | { } /* end */ |
| 17200 | }; |
| 17201 | |
| 17202 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17203 | .ops = &snd_hda_bind_sw, |
| 17204 | .values = { |
| 17205 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17206 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17207 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17208 | 0 |
| 17209 | }, |
| 17210 | }; |
| 17211 | |
| 17212 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17213 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17214 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17215 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17216 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17217 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17218 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17219 | { } /* end */ |
| 17220 | }; |
| 17221 | |
| 17222 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17223 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17224 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17225 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17226 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17227 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17228 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17229 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17230 | { } /* end */ |
| 17231 | }; |
| 17232 | |
| 17233 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17234 | .ops = &snd_hda_bind_vol, |
| 17235 | .values = { |
| 17236 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17237 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17238 | 0 |
| 17239 | }, |
| 17240 | }; |
| 17241 | |
| 17242 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17243 | .ops = &snd_hda_bind_sw, |
| 17244 | .values = { |
| 17245 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17246 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17247 | 0 |
| 17248 | }, |
| 17249 | }; |
| 17250 | |
| 17251 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17252 | HDA_BIND_VOL("Master Playback Volume", |
| 17253 | &alc663_asus_two_bind_master_vol), |
| 17254 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17255 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17256 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17257 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17258 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17259 | { } /* end */ |
| 17260 | }; |
| 17261 | |
| 17262 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17263 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17264 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17265 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17266 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17267 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17268 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17269 | { } /* end */ |
| 17270 | }; |
| 17271 | |
| 17272 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17273 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17274 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17275 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17276 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17277 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17278 | |
| 17279 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17280 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17281 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17282 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17283 | { } /* end */ |
| 17284 | }; |
| 17285 | |
| 17286 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17287 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17288 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17289 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17290 | |
| 17291 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17292 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17293 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17294 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17295 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17296 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17297 | { } /* end */ |
| 17298 | }; |
| 17299 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17300 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17301 | .ops = &snd_hda_bind_sw, |
| 17302 | .values = { |
| 17303 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17304 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17305 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17306 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17307 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17308 | 0 |
| 17309 | }, |
| 17310 | }; |
| 17311 | |
| 17312 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17313 | .ops = &snd_hda_bind_sw, |
| 17314 | .values = { |
| 17315 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17316 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17317 | 0 |
| 17318 | }, |
| 17319 | }; |
| 17320 | |
| 17321 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17322 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17323 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17324 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17325 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17326 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17327 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17328 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17329 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17330 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17331 | { } /* end */ |
| 17332 | }; |
| 17333 | |
| 17334 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17335 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17336 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17337 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17338 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17339 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17340 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17341 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17342 | { } /* end */ |
| 17343 | }; |
| 17344 | |
| 17345 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17346 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17347 | { |
| 17348 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17349 | .name = "Channel Mode", |
| 17350 | .info = alc_ch_mode_info, |
| 17351 | .get = alc_ch_mode_get, |
| 17352 | .put = alc_ch_mode_put, |
| 17353 | }, |
| 17354 | { } /* end */ |
| 17355 | }; |
| 17356 | |
| 17357 | static struct hda_verb alc662_init_verbs[] = { |
| 17358 | /* ADC: mute amp left and right */ |
| 17359 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17360 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17361 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17362 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17363 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17364 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17365 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17366 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17367 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17368 | |
| 17369 | /* Front Pin: output 0 (0x0c) */ |
| 17370 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17371 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17372 | |
| 17373 | /* Rear Pin: output 1 (0x0d) */ |
| 17374 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17375 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17376 | |
| 17377 | /* CLFE Pin: output 2 (0x0e) */ |
| 17378 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17379 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17380 | |
| 17381 | /* Mic (rear) pin: input vref at 80% */ |
| 17382 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17383 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17384 | /* Front Mic pin: input vref at 80% */ |
| 17385 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17386 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17387 | /* Line In pin: input */ |
| 17388 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17389 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17390 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17391 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17392 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17393 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17394 | /* CD pin widget for input */ |
| 17395 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17396 | |
| 17397 | /* FIXME: use matrix-type input source selection */ |
| 17398 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17399 | /* Input mixer */ |
| 17400 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17401 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17402 | |
| 17403 | /* always trun on EAPD */ |
| 17404 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17405 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17406 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17407 | { } |
| 17408 | }; |
| 17409 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17410 | static struct hda_verb alc663_init_verbs[] = { |
| 17411 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17412 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17413 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17414 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17415 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17416 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17417 | { } |
| 17418 | }; |
| 17419 | |
| 17420 | static struct hda_verb alc272_init_verbs[] = { |
| 17421 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17422 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17423 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17424 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17425 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17426 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17427 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17428 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17429 | { } |
| 17430 | }; |
| 17431 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17432 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17433 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17434 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17435 | {} |
| 17436 | }; |
| 17437 | |
| 17438 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17439 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17440 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17441 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17442 | }; |
| 17443 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17444 | /* Set Unsolicited Event*/ |
| 17445 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17446 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17447 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17448 | {} |
| 17449 | }; |
| 17450 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17451 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17452 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17453 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17454 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17455 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17456 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17457 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17458 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17459 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17460 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17461 | {} |
| 17462 | }; |
| 17463 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17464 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17465 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17466 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17467 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17468 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17469 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17470 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17471 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17472 | {} |
| 17473 | }; |
| 17474 | |
| 17475 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17476 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17477 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17478 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17479 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17480 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17481 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17482 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17483 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17484 | {} |
| 17485 | }; |
| 17486 | |
| 17487 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17488 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17489 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17490 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17491 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17492 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17493 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17494 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17495 | {} |
| 17496 | }; |
| 17497 | |
| 17498 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17499 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17500 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17501 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17502 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17503 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17504 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17505 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17506 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17507 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17508 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17509 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17510 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17511 | {} |
| 17512 | }; |
| 17513 | |
| 17514 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 17515 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17516 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17517 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17518 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17519 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17520 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17521 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17522 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17523 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17524 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17525 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17526 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17527 | {} |
| 17528 | }; |
| 17529 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17530 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 17531 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17532 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 17533 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 17534 | |
| 17535 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17536 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17537 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17538 | |
| 17539 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17540 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17541 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 17542 | {} |
| 17543 | }; |
| 17544 | |
| 17545 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 17546 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17547 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17548 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17549 | |
| 17550 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17551 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17552 | {} |
| 17553 | }; |
| 17554 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17555 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 17556 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 17557 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17558 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17559 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17560 | {} |
| 17561 | }; |
| 17562 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17563 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 17564 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17565 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17566 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17567 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17568 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17569 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17570 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17571 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17572 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17573 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17574 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17575 | {} |
| 17576 | }; |
| 17577 | |
| 17578 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 17579 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17580 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17581 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17582 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17583 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17584 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17585 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17586 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17587 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17588 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17589 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17590 | {} |
| 17591 | }; |
| 17592 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17593 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 17594 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17595 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17596 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17597 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17598 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17599 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17600 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17601 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17602 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17603 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17604 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17605 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17606 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17607 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17608 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17609 | {} |
| 17610 | }; |
| 17611 | |
| 17612 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 17613 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17614 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17615 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17616 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17617 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17618 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17619 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17620 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17621 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17622 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17623 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17624 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17625 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17626 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17627 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17628 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17629 | {} |
| 17630 | }; |
| 17631 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17632 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 17633 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 17634 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 17635 | { } /* end */ |
| 17636 | }; |
| 17637 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17638 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 17639 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 17640 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 17641 | { } /* end */ |
| 17642 | }; |
| 17643 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17644 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 17645 | { |
| 17646 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17647 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17648 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17649 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17650 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17651 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17652 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17653 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17654 | } |
| 17655 | |
| 17656 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 17657 | { |
| 17658 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17659 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17660 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17661 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17662 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17663 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17664 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17665 | HDA_AMP_MUTE, bits); |
| 17666 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17667 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17668 | } |
| 17669 | |
| 17670 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 17671 | unsigned int res) |
| 17672 | { |
| 17673 | if ((res >> 26) == ALC880_HP_EVENT) |
| 17674 | alc662_lenovo_101e_all_automute(codec); |
| 17675 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 17676 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 17677 | } |
| 17678 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17679 | /* unsolicited event for HP jack sensing */ |
| 17680 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 17681 | unsigned int res) |
| 17682 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17683 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17684 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17685 | else |
| 17686 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17687 | } |
| 17688 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17689 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17690 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17691 | struct alc_spec *spec = codec->spec; |
| 17692 | |
| 17693 | alc262_hippo1_setup(codec); |
| 17694 | spec->ext_mic.pin = 0x18; |
| 17695 | spec->ext_mic.mux_idx = 0; |
| 17696 | spec->int_mic.pin = 0x19; |
| 17697 | spec->int_mic.mux_idx = 1; |
| 17698 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17699 | } |
| 17700 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17701 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 17702 | { |
| 17703 | alc262_hippo_automute(codec); |
| 17704 | alc_mic_automute(codec); |
| 17705 | } |
| 17706 | |
| 17707 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17708 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17709 | struct alc_spec *spec = codec->spec; |
| 17710 | |
| 17711 | spec->autocfg.hp_pins[0] = 0x14; |
| 17712 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17713 | } |
| 17714 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17715 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 17716 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17717 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 17718 | { |
| 17719 | unsigned int present; |
| 17720 | unsigned char bits; |
| 17721 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17722 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17723 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17724 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17725 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17726 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17727 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17728 | } |
| 17729 | |
| 17730 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 17731 | { |
| 17732 | unsigned int present; |
| 17733 | unsigned char bits; |
| 17734 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17735 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17736 | bits = present ? HDA_AMP_MUTE : 0; |
| 17737 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17738 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17739 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17740 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17741 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17742 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17743 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17744 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17745 | } |
| 17746 | |
| 17747 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 17748 | { |
| 17749 | unsigned int present; |
| 17750 | unsigned char bits; |
| 17751 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17752 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17753 | bits = present ? HDA_AMP_MUTE : 0; |
| 17754 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17755 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17756 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17757 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17758 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17759 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17760 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17761 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17762 | } |
| 17763 | |
| 17764 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 17765 | { |
| 17766 | unsigned int present; |
| 17767 | unsigned char bits; |
| 17768 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17769 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17770 | bits = present ? 0 : PIN_OUT; |
| 17771 | snd_hda_codec_write(codec, 0x14, 0, |
| 17772 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 17773 | } |
| 17774 | |
| 17775 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 17776 | { |
| 17777 | unsigned int present1, present2; |
| 17778 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17779 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 17780 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17781 | |
| 17782 | if (present1 || present2) { |
| 17783 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17784 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17785 | } else { |
| 17786 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17787 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17788 | } |
| 17789 | } |
| 17790 | |
| 17791 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 17792 | { |
| 17793 | unsigned int present1, present2; |
| 17794 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17795 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 17796 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17797 | |
| 17798 | if (present1 || present2) { |
| 17799 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17800 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17801 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17802 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17803 | } else { |
| 17804 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17805 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17806 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17807 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17808 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17809 | } |
| 17810 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17811 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 17812 | { |
| 17813 | unsigned int present1, present2; |
| 17814 | |
| 17815 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 17816 | AC_VERB_GET_PIN_SENSE, 0) |
| 17817 | & AC_PINSENSE_PRESENCE; |
| 17818 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 17819 | AC_VERB_GET_PIN_SENSE, 0) |
| 17820 | & AC_PINSENSE_PRESENCE; |
| 17821 | |
| 17822 | if (present1 || present2) { |
| 17823 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17824 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17825 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17826 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17827 | } else { |
| 17828 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17829 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17830 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17831 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17832 | } |
| 17833 | } |
| 17834 | |
| 17835 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 17836 | { |
| 17837 | unsigned int present1, present2; |
| 17838 | |
| 17839 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 17840 | AC_VERB_GET_PIN_SENSE, 0) |
| 17841 | & AC_PINSENSE_PRESENCE; |
| 17842 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 17843 | AC_VERB_GET_PIN_SENSE, 0) |
| 17844 | & AC_PINSENSE_PRESENCE; |
| 17845 | |
| 17846 | if (present1 || present2) { |
| 17847 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17848 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17849 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17850 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17851 | } else { |
| 17852 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17853 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17854 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17855 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17856 | } |
| 17857 | } |
| 17858 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17859 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 17860 | unsigned int res) |
| 17861 | { |
| 17862 | switch (res >> 26) { |
| 17863 | case ALC880_HP_EVENT: |
| 17864 | alc663_m51va_speaker_automute(codec); |
| 17865 | break; |
| 17866 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17867 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17868 | break; |
| 17869 | } |
| 17870 | } |
| 17871 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17872 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 17873 | { |
| 17874 | struct alc_spec *spec = codec->spec; |
| 17875 | spec->ext_mic.pin = 0x18; |
| 17876 | spec->ext_mic.mux_idx = 0; |
| 17877 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17878 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17879 | spec->auto_mic = 1; |
| 17880 | } |
| 17881 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17882 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 17883 | { |
| 17884 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17885 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17886 | } |
| 17887 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17888 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17889 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17890 | |
| 17891 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 17892 | { |
| 17893 | struct alc_spec *spec = codec->spec; |
| 17894 | spec->ext_mic.pin = 0x18; |
| 17895 | spec->ext_mic.mux_idx = 0; |
| 17896 | spec->int_mic.pin = 0x19; |
| 17897 | spec->int_mic.mux_idx = 1; |
| 17898 | spec->auto_mic = 1; |
| 17899 | } |
| 17900 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17901 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17902 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17903 | /* ***************** Mode2 ******************************/ |
| 17904 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 17905 | unsigned int res) |
| 17906 | { |
| 17907 | switch (res >> 26) { |
| 17908 | case ALC880_HP_EVENT: |
| 17909 | alc662_f5z_speaker_automute(codec); |
| 17910 | break; |
| 17911 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17912 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17913 | break; |
| 17914 | } |
| 17915 | } |
| 17916 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17917 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17918 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17919 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 17920 | { |
| 17921 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17922 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17923 | } |
| 17924 | /* ***************** Mode3 ******************************/ |
| 17925 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 17926 | unsigned int res) |
| 17927 | { |
| 17928 | switch (res >> 26) { |
| 17929 | case ALC880_HP_EVENT: |
| 17930 | alc663_two_hp_m1_speaker_automute(codec); |
| 17931 | break; |
| 17932 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17933 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17934 | break; |
| 17935 | } |
| 17936 | } |
| 17937 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17938 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17939 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17940 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 17941 | { |
| 17942 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17943 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17944 | } |
| 17945 | /* ***************** Mode4 ******************************/ |
| 17946 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 17947 | unsigned int res) |
| 17948 | { |
| 17949 | switch (res >> 26) { |
| 17950 | case ALC880_HP_EVENT: |
| 17951 | alc663_21jd_two_speaker_automute(codec); |
| 17952 | break; |
| 17953 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17954 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17955 | break; |
| 17956 | } |
| 17957 | } |
| 17958 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17959 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17960 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17961 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 17962 | { |
| 17963 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17964 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17965 | } |
| 17966 | /* ***************** Mode5 ******************************/ |
| 17967 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 17968 | unsigned int res) |
| 17969 | { |
| 17970 | switch (res >> 26) { |
| 17971 | case ALC880_HP_EVENT: |
| 17972 | alc663_15jd_two_speaker_automute(codec); |
| 17973 | break; |
| 17974 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17975 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17976 | break; |
| 17977 | } |
| 17978 | } |
| 17979 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17980 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17981 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17982 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 17983 | { |
| 17984 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17985 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17986 | } |
| 17987 | /* ***************** Mode6 ******************************/ |
| 17988 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 17989 | unsigned int res) |
| 17990 | { |
| 17991 | switch (res >> 26) { |
| 17992 | case ALC880_HP_EVENT: |
| 17993 | alc663_two_hp_m2_speaker_automute(codec); |
| 17994 | break; |
| 17995 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17996 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17997 | break; |
| 17998 | } |
| 17999 | } |
| 18000 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18001 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18002 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18003 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 18004 | { |
| 18005 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18006 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18007 | } |
| 18008 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18009 | /* ***************** Mode7 ******************************/ |
| 18010 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 18011 | unsigned int res) |
| 18012 | { |
| 18013 | switch (res >> 26) { |
| 18014 | case ALC880_HP_EVENT: |
| 18015 | alc663_two_hp_m7_speaker_automute(codec); |
| 18016 | break; |
| 18017 | case ALC880_MIC_EVENT: |
| 18018 | alc_mic_automute(codec); |
| 18019 | break; |
| 18020 | } |
| 18021 | } |
| 18022 | |
| 18023 | #define alc663_mode7_setup alc663_mode1_setup |
| 18024 | |
| 18025 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 18026 | { |
| 18027 | alc663_two_hp_m7_speaker_automute(codec); |
| 18028 | alc_mic_automute(codec); |
| 18029 | } |
| 18030 | |
| 18031 | /* ***************** Mode8 ******************************/ |
| 18032 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 18033 | unsigned int res) |
| 18034 | { |
| 18035 | switch (res >> 26) { |
| 18036 | case ALC880_HP_EVENT: |
| 18037 | alc663_two_hp_m8_speaker_automute(codec); |
| 18038 | break; |
| 18039 | case ALC880_MIC_EVENT: |
| 18040 | alc_mic_automute(codec); |
| 18041 | break; |
| 18042 | } |
| 18043 | } |
| 18044 | |
| 18045 | #define alc663_mode8_setup alc663_m51va_setup |
| 18046 | |
| 18047 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 18048 | { |
| 18049 | alc663_two_hp_m8_speaker_automute(codec); |
| 18050 | alc_mic_automute(codec); |
| 18051 | } |
| 18052 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18053 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 18054 | { |
| 18055 | unsigned int present; |
| 18056 | unsigned char bits; |
| 18057 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18058 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18059 | bits = present ? HDA_AMP_MUTE : 0; |
| 18060 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18061 | HDA_AMP_MUTE, bits); |
| 18062 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18063 | HDA_AMP_MUTE, bits); |
| 18064 | } |
| 18065 | |
| 18066 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 18067 | { |
| 18068 | unsigned int present; |
| 18069 | unsigned char bits; |
| 18070 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18071 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18072 | bits = present ? HDA_AMP_MUTE : 0; |
| 18073 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18074 | HDA_AMP_MUTE, bits); |
| 18075 | } |
| 18076 | |
| 18077 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 18078 | unsigned int res) |
| 18079 | { |
| 18080 | switch (res >> 26) { |
| 18081 | case ALC880_HP_EVENT: |
| 18082 | alc663_g71v_hp_automute(codec); |
| 18083 | break; |
| 18084 | case ALC880_FRONT_EVENT: |
| 18085 | alc663_g71v_front_automute(codec); |
| 18086 | break; |
| 18087 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18088 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18089 | break; |
| 18090 | } |
| 18091 | } |
| 18092 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18093 | #define alc663_g71v_setup alc663_m51va_setup |
| 18094 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18095 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 18096 | { |
| 18097 | alc663_g71v_front_automute(codec); |
| 18098 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18099 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18100 | } |
| 18101 | |
| 18102 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 18103 | unsigned int res) |
| 18104 | { |
| 18105 | switch (res >> 26) { |
| 18106 | case ALC880_HP_EVENT: |
| 18107 | alc663_m51va_speaker_automute(codec); |
| 18108 | break; |
| 18109 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18110 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18111 | break; |
| 18112 | } |
| 18113 | } |
| 18114 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18115 | #define alc663_g50v_setup alc663_m51va_setup |
| 18116 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18117 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 18118 | { |
| 18119 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18120 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18121 | } |
| 18122 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18123 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18124 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18125 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18126 | |
| 18127 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 18128 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18129 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18130 | |
| 18131 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 18132 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18133 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18134 | { } /* end */ |
| 18135 | }; |
| 18136 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18137 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18138 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18139 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18140 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18141 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18142 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18143 | |
| 18144 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18145 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18146 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 18147 | |
| 18148 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18149 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18150 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 18151 | { } /* end */ |
| 18152 | }; |
| 18153 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18154 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18155 | #define alc662_loopbacks alc880_loopbacks |
| 18156 | #endif |
| 18157 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18158 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18159 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18160 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18161 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18162 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18163 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18164 | |
| 18165 | /* |
| 18166 | * configuration and preset |
| 18167 | */ |
| 18168 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 18169 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18170 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18171 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 18172 | [ALC662_5ST_DIG] = "6stack-dig", |
| 18173 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18174 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18175 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18176 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18177 | [ALC663_ASUS_M51VA] = "m51va", |
| 18178 | [ALC663_ASUS_G71V] = "g71v", |
| 18179 | [ALC663_ASUS_H13] = "h13", |
| 18180 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18181 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18182 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18183 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18184 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18185 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18186 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18187 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18188 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18189 | [ALC272_DELL] = "dell", |
| 18190 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18191 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18192 | [ALC662_AUTO] = "auto", |
| 18193 | }; |
| 18194 | |
| 18195 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18196 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18197 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18198 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18199 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18200 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18201 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18202 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18203 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18204 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18205 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18206 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18207 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18208 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18209 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18210 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18211 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18212 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18213 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18214 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18215 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18216 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18217 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18218 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18219 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18220 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18221 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18222 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18223 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18224 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18225 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18226 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18227 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18228 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18229 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18230 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18231 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18232 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18233 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18234 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18235 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18236 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18237 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18238 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18239 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18240 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18241 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18242 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18243 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18244 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18245 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18246 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18247 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18248 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18249 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18250 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18251 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18252 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18253 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18254 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18255 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18256 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18257 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18258 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18259 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18260 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18261 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18262 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 18263 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18264 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18265 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18266 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18267 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18268 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18269 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18270 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18271 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18272 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18273 | {} |
| 18274 | }; |
| 18275 | |
| 18276 | static struct alc_config_preset alc662_presets[] = { |
| 18277 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18278 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18279 | .init_verbs = { alc662_init_verbs }, |
| 18280 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18281 | .dac_nids = alc662_dac_nids, |
| 18282 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18283 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18284 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18285 | .channel_mode = alc662_3ST_2ch_modes, |
| 18286 | .input_mux = &alc662_capture_source, |
| 18287 | }, |
| 18288 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18289 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18290 | .init_verbs = { alc662_init_verbs }, |
| 18291 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18292 | .dac_nids = alc662_dac_nids, |
| 18293 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18294 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18295 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18296 | .channel_mode = alc662_3ST_6ch_modes, |
| 18297 | .need_dac_fix = 1, |
| 18298 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18299 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18300 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18301 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18302 | .init_verbs = { alc662_init_verbs }, |
| 18303 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18304 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18305 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18306 | .channel_mode = alc662_3ST_6ch_modes, |
| 18307 | .need_dac_fix = 1, |
| 18308 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18309 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18310 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18311 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18312 | .init_verbs = { alc662_init_verbs }, |
| 18313 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18314 | .dac_nids = alc662_dac_nids, |
| 18315 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18316 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18317 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18318 | .channel_mode = alc662_5stack_modes, |
| 18319 | .input_mux = &alc662_capture_source, |
| 18320 | }, |
| 18321 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18322 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18323 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18324 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18325 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18326 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18327 | .channel_mode = alc662_3ST_2ch_modes, |
| 18328 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18329 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18330 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18331 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18332 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18333 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18334 | .init_verbs = { alc662_init_verbs, |
| 18335 | alc662_eeepc_sue_init_verbs }, |
| 18336 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18337 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18338 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18339 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18340 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18341 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18342 | .init_hook = alc662_eeepc_inithook, |
| 18343 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18344 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18345 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18346 | alc662_chmode_mixer }, |
| 18347 | .init_verbs = { alc662_init_verbs, |
| 18348 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18349 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18350 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18351 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18352 | .channel_mode = alc662_3ST_6ch_modes, |
| 18353 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18354 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18355 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18356 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18357 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18358 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18359 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18360 | .init_verbs = { alc662_init_verbs, |
| 18361 | alc662_ecs_init_verbs }, |
| 18362 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18363 | .dac_nids = alc662_dac_nids, |
| 18364 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18365 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18366 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18367 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18368 | .init_hook = alc662_eeepc_inithook, |
| 18369 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18370 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18371 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18372 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18373 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18374 | .dac_nids = alc662_dac_nids, |
| 18375 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18376 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18377 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18378 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18379 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18380 | .init_hook = alc663_m51va_inithook, |
| 18381 | }, |
| 18382 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18383 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18384 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 18385 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18386 | .dac_nids = alc662_dac_nids, |
| 18387 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18388 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18389 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18390 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18391 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18392 | .init_hook = alc663_g71v_inithook, |
| 18393 | }, |
| 18394 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18395 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18396 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18397 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18398 | .dac_nids = alc662_dac_nids, |
| 18399 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18400 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18401 | .unsol_event = alc663_m51va_unsol_event, |
| 18402 | .init_hook = alc663_m51va_inithook, |
| 18403 | }, |
| 18404 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18405 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18406 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18407 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18408 | .dac_nids = alc662_dac_nids, |
| 18409 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18410 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18411 | .channel_mode = alc662_3ST_6ch_modes, |
| 18412 | .input_mux = &alc663_capture_source, |
| 18413 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18414 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18415 | .init_hook = alc663_g50v_inithook, |
| 18416 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18417 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18418 | .mixers = { alc663_m51va_mixer }, |
| 18419 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18420 | .init_verbs = { alc662_init_verbs, |
| 18421 | alc663_21jd_amic_init_verbs }, |
| 18422 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18423 | .hp_nid = 0x03, |
| 18424 | .dac_nids = alc662_dac_nids, |
| 18425 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18426 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18427 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18428 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18429 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18430 | .init_hook = alc663_mode1_inithook, |
| 18431 | }, |
| 18432 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18433 | .mixers = { alc662_1bjd_mixer }, |
| 18434 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18435 | .init_verbs = { alc662_init_verbs, |
| 18436 | alc662_1bjd_amic_init_verbs }, |
| 18437 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18438 | .dac_nids = alc662_dac_nids, |
| 18439 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18440 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18441 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18442 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18443 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18444 | .init_hook = alc662_mode2_inithook, |
| 18445 | }, |
| 18446 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18447 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18448 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18449 | .init_verbs = { alc662_init_verbs, |
| 18450 | alc663_two_hp_amic_m1_init_verbs }, |
| 18451 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18452 | .hp_nid = 0x03, |
| 18453 | .dac_nids = alc662_dac_nids, |
| 18454 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18455 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18456 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18457 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18458 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18459 | .init_hook = alc663_mode3_inithook, |
| 18460 | }, |
| 18461 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18462 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18463 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18464 | .init_verbs = { alc662_init_verbs, |
| 18465 | alc663_21jd_amic_init_verbs}, |
| 18466 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18467 | .hp_nid = 0x03, |
| 18468 | .dac_nids = alc662_dac_nids, |
| 18469 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18470 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18471 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18472 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18473 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18474 | .init_hook = alc663_mode4_inithook, |
| 18475 | }, |
| 18476 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18477 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18478 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18479 | .init_verbs = { alc662_init_verbs, |
| 18480 | alc663_15jd_amic_init_verbs }, |
| 18481 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18482 | .hp_nid = 0x03, |
| 18483 | .dac_nids = alc662_dac_nids, |
| 18484 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18485 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18486 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18487 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18488 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18489 | .init_hook = alc663_mode5_inithook, |
| 18490 | }, |
| 18491 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18492 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18493 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18494 | .init_verbs = { alc662_init_verbs, |
| 18495 | alc663_two_hp_amic_m2_init_verbs }, |
| 18496 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18497 | .hp_nid = 0x03, |
| 18498 | .dac_nids = alc662_dac_nids, |
| 18499 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18500 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18501 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18502 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18503 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18504 | .init_hook = alc663_mode6_inithook, |
| 18505 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18506 | [ALC663_ASUS_MODE7] = { |
| 18507 | .mixers = { alc663_mode7_mixer }, |
| 18508 | .cap_mixer = alc662_auto_capture_mixer, |
| 18509 | .init_verbs = { alc662_init_verbs, |
| 18510 | alc663_mode7_init_verbs }, |
| 18511 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18512 | .hp_nid = 0x03, |
| 18513 | .dac_nids = alc662_dac_nids, |
| 18514 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18515 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18516 | .channel_mode = alc662_3ST_2ch_modes, |
| 18517 | .unsol_event = alc663_mode7_unsol_event, |
| 18518 | .setup = alc663_mode7_setup, |
| 18519 | .init_hook = alc663_mode7_inithook, |
| 18520 | }, |
| 18521 | [ALC663_ASUS_MODE8] = { |
| 18522 | .mixers = { alc663_mode8_mixer }, |
| 18523 | .cap_mixer = alc662_auto_capture_mixer, |
| 18524 | .init_verbs = { alc662_init_verbs, |
| 18525 | alc663_mode8_init_verbs }, |
| 18526 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18527 | .hp_nid = 0x03, |
| 18528 | .dac_nids = alc662_dac_nids, |
| 18529 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18530 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18531 | .channel_mode = alc662_3ST_2ch_modes, |
| 18532 | .unsol_event = alc663_mode8_unsol_event, |
| 18533 | .setup = alc663_mode8_setup, |
| 18534 | .init_hook = alc663_mode8_inithook, |
| 18535 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18536 | [ALC272_DELL] = { |
| 18537 | .mixers = { alc663_m51va_mixer }, |
| 18538 | .cap_mixer = alc272_auto_capture_mixer, |
| 18539 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 18540 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18541 | .dac_nids = alc662_dac_nids, |
| 18542 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18543 | .adc_nids = alc272_adc_nids, |
| 18544 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18545 | .capsrc_nids = alc272_capsrc_nids, |
| 18546 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18547 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18548 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18549 | .init_hook = alc663_m51va_inithook, |
| 18550 | }, |
| 18551 | [ALC272_DELL_ZM1] = { |
| 18552 | .mixers = { alc663_m51va_mixer }, |
| 18553 | .cap_mixer = alc662_auto_capture_mixer, |
| 18554 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 18555 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18556 | .dac_nids = alc662_dac_nids, |
| 18557 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18558 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18559 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18560 | .capsrc_nids = alc662_capsrc_nids, |
| 18561 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18562 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18563 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18564 | .init_hook = alc663_m51va_inithook, |
| 18565 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18566 | [ALC272_SAMSUNG_NC10] = { |
| 18567 | .mixers = { alc272_nc10_mixer }, |
| 18568 | .init_verbs = { alc662_init_verbs, |
| 18569 | alc663_21jd_amic_init_verbs }, |
| 18570 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18571 | .dac_nids = alc272_dac_nids, |
| 18572 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18573 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18574 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18575 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18576 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18577 | .init_hook = alc663_mode4_inithook, |
| 18578 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18579 | }; |
| 18580 | |
| 18581 | |
| 18582 | /* |
| 18583 | * BIOS auto configuration |
| 18584 | */ |
| 18585 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18586 | /* convert from MIX nid to DAC */ |
| 18587 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 18588 | { |
| 18589 | if (nid == 0x0f) |
| 18590 | return 0x02; |
| 18591 | else if (nid >= 0x0c && nid <= 0x0e) |
| 18592 | return nid - 0x0c + 0x02; |
| 18593 | else |
| 18594 | return 0; |
| 18595 | } |
| 18596 | |
| 18597 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 18598 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 18599 | hda_nid_t dac) |
| 18600 | { |
| 18601 | hda_nid_t mix[4]; |
| 18602 | int i, num; |
| 18603 | |
| 18604 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18605 | for (i = 0; i < num; i++) { |
| 18606 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 18607 | return mix[i]; |
| 18608 | } |
| 18609 | return 0; |
| 18610 | } |
| 18611 | |
| 18612 | /* look for an empty DAC slot */ |
| 18613 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 18614 | { |
| 18615 | struct alc_spec *spec = codec->spec; |
| 18616 | hda_nid_t srcs[5]; |
| 18617 | int i, j, num; |
| 18618 | |
| 18619 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 18620 | if (num < 0) |
| 18621 | return 0; |
| 18622 | for (i = 0; i < num; i++) { |
| 18623 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 18624 | if (!nid) |
| 18625 | continue; |
| 18626 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 18627 | if (spec->multiout.dac_nids[j] == nid) |
| 18628 | break; |
| 18629 | if (j >= spec->multiout.num_dacs) |
| 18630 | return nid; |
| 18631 | } |
| 18632 | return 0; |
| 18633 | } |
| 18634 | |
| 18635 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 18636 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 18637 | const struct auto_pin_cfg *cfg) |
| 18638 | { |
| 18639 | struct alc_spec *spec = codec->spec; |
| 18640 | int i; |
| 18641 | hda_nid_t dac; |
| 18642 | |
| 18643 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 18644 | for (i = 0; i < cfg->line_outs; i++) { |
| 18645 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 18646 | if (!dac) |
| 18647 | continue; |
| 18648 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 18649 | } |
| 18650 | return 0; |
| 18651 | } |
| 18652 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18653 | 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] | 18654 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18655 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18656 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18657 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 18658 | } |
| 18659 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18660 | 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] | 18661 | hda_nid_t nid, unsigned int chs) |
| 18662 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18663 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18664 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 18665 | } |
| 18666 | |
| 18667 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 18668 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 18669 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 18670 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 18671 | |
| 18672 | /* add playback controls from the parsed DAC table */ |
| 18673 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 18674 | const struct auto_pin_cfg *cfg) |
| 18675 | { |
| 18676 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18677 | static const char *chname[4] = { |
| 18678 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 18679 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18680 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18681 | int i, err; |
| 18682 | |
| 18683 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18684 | nid = spec->multiout.dac_nids[i]; |
| 18685 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18686 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18687 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 18688 | if (!mix) |
| 18689 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18690 | if (i == 2) { |
| 18691 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18692 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18693 | if (err < 0) |
| 18694 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18695 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18696 | if (err < 0) |
| 18697 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18698 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18699 | if (err < 0) |
| 18700 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18701 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18702 | if (err < 0) |
| 18703 | return err; |
| 18704 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18705 | const char *pfx; |
| 18706 | if (cfg->line_outs == 1 && |
| 18707 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18708 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18709 | pfx = "Speaker"; |
| 18710 | else |
| 18711 | pfx = "PCM"; |
| 18712 | } else |
| 18713 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18714 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18715 | if (err < 0) |
| 18716 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18717 | if (cfg->line_outs == 1 && |
| 18718 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 18719 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18720 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18721 | if (err < 0) |
| 18722 | return err; |
| 18723 | } |
| 18724 | } |
| 18725 | return 0; |
| 18726 | } |
| 18727 | |
| 18728 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18729 | /* return DAC nid if any new DAC is assigned */ |
| 18730 | 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] | 18731 | const char *pfx) |
| 18732 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18733 | struct alc_spec *spec = codec->spec; |
| 18734 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18735 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18736 | |
| 18737 | if (!pin) |
| 18738 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18739 | nid = alc662_look_for_dac(codec, pin); |
| 18740 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18741 | /* the corresponding DAC is already occupied */ |
| 18742 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 18743 | return 0; /* no way */ |
| 18744 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18745 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18746 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 18747 | } |
| 18748 | |
| 18749 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 18750 | if (!mix) |
| 18751 | return 0; |
| 18752 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 18753 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 18754 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18755 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 18756 | if (err < 0) |
| 18757 | return err; |
| 18758 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18759 | } |
| 18760 | |
| 18761 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18762 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 18763 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18764 | |
| 18765 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 18766 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18767 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18768 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18769 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 18770 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18771 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18772 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18773 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18774 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 18775 | if (num <= 1) |
| 18776 | return; |
| 18777 | for (i = 0; i < num; i++) { |
| 18778 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 18779 | continue; |
| 18780 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 18781 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18782 | } |
| 18783 | } |
| 18784 | |
| 18785 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 18786 | { |
| 18787 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18788 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18789 | int i; |
| 18790 | |
| 18791 | for (i = 0; i <= HDA_SIDE; i++) { |
| 18792 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 18793 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 18794 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18795 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18796 | } |
| 18797 | } |
| 18798 | |
| 18799 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 18800 | { |
| 18801 | struct alc_spec *spec = codec->spec; |
| 18802 | hda_nid_t pin; |
| 18803 | |
| 18804 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18805 | if (pin) |
| 18806 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 18807 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18808 | pin = spec->autocfg.speaker_pins[0]; |
| 18809 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18810 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 18811 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18812 | } |
| 18813 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18814 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 18815 | |
| 18816 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 18817 | { |
| 18818 | struct alc_spec *spec = codec->spec; |
| 18819 | int i; |
| 18820 | |
| 18821 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 18822 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18823 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 18824 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 18825 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 18826 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18827 | snd_hda_codec_write(codec, nid, 0, |
| 18828 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 18829 | AMP_OUT_MUTE); |
| 18830 | } |
| 18831 | } |
| 18832 | } |
| 18833 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18834 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 18835 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18836 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 18837 | { |
| 18838 | struct alc_spec *spec = codec->spec; |
| 18839 | int err; |
| 18840 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 18841 | |
| 18842 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 18843 | alc662_ignore); |
| 18844 | if (err < 0) |
| 18845 | return err; |
| 18846 | if (!spec->autocfg.line_outs) |
| 18847 | return 0; /* can't find valid BIOS pin config */ |
| 18848 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18849 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18850 | if (err < 0) |
| 18851 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18852 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18853 | if (err < 0) |
| 18854 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18855 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18856 | spec->autocfg.speaker_pins[0], |
| 18857 | "Speaker"); |
| 18858 | if (err < 0) |
| 18859 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18860 | if (err) |
| 18861 | spec->multiout.extra_out_nid[0] = err; |
| 18862 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18863 | "Headphone"); |
| 18864 | if (err < 0) |
| 18865 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18866 | if (err) |
| 18867 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18868 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18869 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18870 | return err; |
| 18871 | |
| 18872 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 18873 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 18874 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18875 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 18876 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 18877 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18878 | |
| 18879 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 18880 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 18881 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18882 | add_verb(spec, alc662_init_verbs); |
| 18883 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 18884 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18885 | add_verb(spec, alc663_init_verbs); |
| 18886 | |
| 18887 | if (codec->vendor_id == 0x10ec0272) |
| 18888 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 18889 | |
| 18890 | err = alc_auto_add_mic_boost(codec); |
| 18891 | if (err < 0) |
| 18892 | return err; |
| 18893 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18894 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 18895 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 18896 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 18897 | else |
| 18898 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 18899 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18900 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18901 | } |
| 18902 | |
| 18903 | /* additional initialization for auto-configuration model */ |
| 18904 | static void alc662_auto_init(struct hda_codec *codec) |
| 18905 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18906 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18907 | alc662_auto_init_multi_out(codec); |
| 18908 | alc662_auto_init_hp_out(codec); |
| 18909 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18910 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 18911 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18912 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 18913 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18914 | } |
| 18915 | |
| 18916 | static int patch_alc662(struct hda_codec *codec) |
| 18917 | { |
| 18918 | struct alc_spec *spec; |
| 18919 | int err, board_config; |
| 18920 | |
| 18921 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 18922 | if (!spec) |
| 18923 | return -ENOMEM; |
| 18924 | |
| 18925 | codec->spec = spec; |
| 18926 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 18927 | alc_auto_parse_customize_define(codec); |
| 18928 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 18929 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 18930 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 18931 | if (alc_read_coef_idx(codec, 0) == 0x8020) |
| 18932 | alc_codec_rename(codec, "ALC661"); |
| 18933 | else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) && |
| 18934 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 18935 | spec->cdefine.platform_type == 1) |
| 18936 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18937 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18938 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 18939 | alc662_models, |
| 18940 | alc662_cfg_tbl); |
| 18941 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 18942 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 18943 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18944 | board_config = ALC662_AUTO; |
| 18945 | } |
| 18946 | |
| 18947 | if (board_config == ALC662_AUTO) { |
| 18948 | /* automatic parse from the BIOS config */ |
| 18949 | err = alc662_parse_auto_config(codec); |
| 18950 | if (err < 0) { |
| 18951 | alc_free(codec); |
| 18952 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18953 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18954 | printk(KERN_INFO |
| 18955 | "hda_codec: Cannot set up configuration " |
| 18956 | "from BIOS. Using base mode...\n"); |
| 18957 | board_config = ALC662_3ST_2ch_DIG; |
| 18958 | } |
| 18959 | } |
| 18960 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 18961 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 18962 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 18963 | if (err < 0) { |
| 18964 | alc_free(codec); |
| 18965 | return err; |
| 18966 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 18967 | } |
| 18968 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18969 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 18970 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18971 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18972 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 18973 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 18974 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18975 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 18976 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 18977 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 18978 | if (!spec->adc_nids) { |
| 18979 | spec->adc_nids = alc662_adc_nids; |
| 18980 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 18981 | } |
| 18982 | if (!spec->capsrc_nids) |
| 18983 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18984 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18985 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18986 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18987 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 18988 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 18989 | switch (codec->vendor_id) { |
| 18990 | case 0x10ec0662: |
| 18991 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 18992 | break; |
| 18993 | case 0x10ec0272: |
| 18994 | case 0x10ec0663: |
| 18995 | case 0x10ec0665: |
| 18996 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 18997 | break; |
| 18998 | case 0x10ec0273: |
| 18999 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19000 | break; |
| 19001 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19002 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19003 | spec->vmaster_nid = 0x02; |
| 19004 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19005 | codec->patch_ops = alc_patch_ops; |
| 19006 | if (board_config == ALC662_AUTO) |
| 19007 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19008 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19009 | if (!spec->loopback.amplist) |
| 19010 | spec->loopback.amplist = alc662_loopbacks; |
| 19011 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19012 | |
| 19013 | return 0; |
| 19014 | } |
| 19015 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19016 | static int patch_alc888(struct hda_codec *codec) |
| 19017 | { |
| 19018 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19019 | kfree(codec->chip_name); |
| 19020 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19021 | if (!codec->chip_name) { |
| 19022 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19023 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19024 | } |
| 19025 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19026 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19027 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19028 | } |
| 19029 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19030 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19031 | * ALC680 support |
| 19032 | */ |
| 19033 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19034 | #define alc680_modes alc260_modes |
| 19035 | |
| 19036 | static hda_nid_t alc680_dac_nids[3] = { |
| 19037 | /* Lout1, Lout2, hp */ |
| 19038 | 0x02, 0x03, 0x04 |
| 19039 | }; |
| 19040 | |
| 19041 | static hda_nid_t alc680_adc_nids[3] = { |
| 19042 | /* ADC0-2 */ |
| 19043 | /* DMIC, MIC, Line-in*/ |
| 19044 | 0x07, 0x08, 0x09 |
| 19045 | }; |
| 19046 | |
| 19047 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19048 | /* output mixer control */ |
| 19049 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19050 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19051 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19052 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 19053 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 19054 | { } |
| 19055 | }; |
| 19056 | |
| 19057 | static struct snd_kcontrol_new alc680_capture_mixer[] = { |
| 19058 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 19059 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 19060 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 19061 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 19062 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 19063 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 19064 | { } /* end */ |
| 19065 | }; |
| 19066 | |
| 19067 | /* |
| 19068 | * generic initialization of ADC, input mixers and output mixers |
| 19069 | */ |
| 19070 | static struct hda_verb alc680_init_verbs[] = { |
| 19071 | /* Unmute DAC0-1 and set vol = 0 */ |
| 19072 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 19073 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 19074 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 19075 | |
| 19076 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 19077 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 19078 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 19079 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 19080 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 19081 | |
| 19082 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19083 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19084 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19085 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19086 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19087 | { } |
| 19088 | }; |
| 19089 | |
| 19090 | /* create input playback/capture controls for the given pin */ |
| 19091 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19092 | const char *ctlname, int idx) |
| 19093 | { |
| 19094 | hda_nid_t dac; |
| 19095 | int err; |
| 19096 | |
| 19097 | switch (nid) { |
| 19098 | case 0x14: |
| 19099 | dac = 0x02; |
| 19100 | break; |
| 19101 | case 0x15: |
| 19102 | dac = 0x03; |
| 19103 | break; |
| 19104 | case 0x16: |
| 19105 | dac = 0x04; |
| 19106 | break; |
| 19107 | default: |
| 19108 | return 0; |
| 19109 | } |
| 19110 | if (spec->multiout.dac_nids[0] != dac && |
| 19111 | spec->multiout.dac_nids[1] != dac) { |
| 19112 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19113 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19114 | HDA_OUTPUT)); |
| 19115 | if (err < 0) |
| 19116 | return err; |
| 19117 | |
| 19118 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19119 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19120 | |
| 19121 | if (err < 0) |
| 19122 | return err; |
| 19123 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19124 | } |
| 19125 | |
| 19126 | return 0; |
| 19127 | } |
| 19128 | |
| 19129 | /* add playback controls from the parsed DAC table */ |
| 19130 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19131 | const struct auto_pin_cfg *cfg) |
| 19132 | { |
| 19133 | hda_nid_t nid; |
| 19134 | int err; |
| 19135 | |
| 19136 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19137 | |
| 19138 | nid = cfg->line_out_pins[0]; |
| 19139 | if (nid) { |
| 19140 | const char *name; |
| 19141 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19142 | name = "Speaker"; |
| 19143 | else |
| 19144 | name = "Front"; |
| 19145 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19146 | if (err < 0) |
| 19147 | return err; |
| 19148 | } |
| 19149 | |
| 19150 | nid = cfg->speaker_pins[0]; |
| 19151 | if (nid) { |
| 19152 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19153 | if (err < 0) |
| 19154 | return err; |
| 19155 | } |
| 19156 | nid = cfg->hp_pins[0]; |
| 19157 | if (nid) { |
| 19158 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19159 | if (err < 0) |
| 19160 | return err; |
| 19161 | } |
| 19162 | |
| 19163 | return 0; |
| 19164 | } |
| 19165 | |
| 19166 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19167 | hda_nid_t nid, int pin_type) |
| 19168 | { |
| 19169 | alc_set_pin_output(codec, nid, pin_type); |
| 19170 | } |
| 19171 | |
| 19172 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19173 | { |
| 19174 | struct alc_spec *spec = codec->spec; |
| 19175 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19176 | if (nid) { |
| 19177 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19178 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19179 | } |
| 19180 | } |
| 19181 | |
| 19182 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19183 | { |
| 19184 | struct alc_spec *spec = codec->spec; |
| 19185 | hda_nid_t pin; |
| 19186 | |
| 19187 | pin = spec->autocfg.hp_pins[0]; |
| 19188 | if (pin) |
| 19189 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19190 | pin = spec->autocfg.speaker_pins[0]; |
| 19191 | if (pin) |
| 19192 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19193 | } |
| 19194 | |
| 19195 | /* pcm configuration: identical with ALC880 */ |
| 19196 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19197 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19198 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19199 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
| 19200 | |
| 19201 | static struct hda_input_mux alc680_capture_source = { |
| 19202 | .num_items = 1, |
| 19203 | .items = { |
| 19204 | { "Mic", 0x0 }, |
| 19205 | }, |
| 19206 | }; |
| 19207 | |
| 19208 | /* |
| 19209 | * BIOS auto configuration |
| 19210 | */ |
| 19211 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19212 | { |
| 19213 | struct alc_spec *spec = codec->spec; |
| 19214 | int err; |
| 19215 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19216 | |
| 19217 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19218 | alc680_ignore); |
| 19219 | if (err < 0) |
| 19220 | return err; |
| 19221 | if (!spec->autocfg.line_outs) { |
| 19222 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19223 | spec->multiout.max_channels = 2; |
| 19224 | spec->no_analog = 1; |
| 19225 | goto dig_only; |
| 19226 | } |
| 19227 | return 0; /* can't find valid BIOS pin config */ |
| 19228 | } |
| 19229 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19230 | if (err < 0) |
| 19231 | return err; |
| 19232 | |
| 19233 | spec->multiout.max_channels = 2; |
| 19234 | |
| 19235 | dig_only: |
| 19236 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19237 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19238 | if (spec->kctls.list) |
| 19239 | add_mixer(spec, spec->kctls.list); |
| 19240 | |
| 19241 | add_verb(spec, alc680_init_verbs); |
| 19242 | spec->num_mux_defs = 1; |
| 19243 | spec->input_mux = &alc680_capture_source; |
| 19244 | |
| 19245 | err = alc_auto_add_mic_boost(codec); |
| 19246 | if (err < 0) |
| 19247 | return err; |
| 19248 | |
| 19249 | return 1; |
| 19250 | } |
| 19251 | |
| 19252 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19253 | |
| 19254 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19255 | static void alc680_auto_init(struct hda_codec *codec) |
| 19256 | { |
| 19257 | struct alc_spec *spec = codec->spec; |
| 19258 | alc680_auto_init_multi_out(codec); |
| 19259 | alc680_auto_init_hp_out(codec); |
| 19260 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19261 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19262 | if (spec->unsol_event) |
| 19263 | alc_inithook(codec); |
| 19264 | } |
| 19265 | |
| 19266 | /* |
| 19267 | * configuration and preset |
| 19268 | */ |
| 19269 | static const char *alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19270 | [ALC680_BASE] = "base", |
| 19271 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19272 | }; |
| 19273 | |
| 19274 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 19275 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19276 | {} |
| 19277 | }; |
| 19278 | |
| 19279 | static struct alc_config_preset alc680_presets[] = { |
| 19280 | [ALC680_BASE] = { |
| 19281 | .mixers = { alc680_base_mixer }, |
| 19282 | .cap_mixer = alc680_capture_mixer, |
| 19283 | .init_verbs = { alc680_init_verbs }, |
| 19284 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19285 | .dac_nids = alc680_dac_nids, |
| 19286 | .num_adc_nids = ARRAY_SIZE(alc680_adc_nids), |
| 19287 | .adc_nids = alc680_adc_nids, |
| 19288 | .hp_nid = 0x04, |
| 19289 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19290 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19291 | .channel_mode = alc680_modes, |
| 19292 | .input_mux = &alc680_capture_source, |
| 19293 | }, |
| 19294 | }; |
| 19295 | |
| 19296 | static int patch_alc680(struct hda_codec *codec) |
| 19297 | { |
| 19298 | struct alc_spec *spec; |
| 19299 | int board_config; |
| 19300 | int err; |
| 19301 | |
| 19302 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19303 | if (spec == NULL) |
| 19304 | return -ENOMEM; |
| 19305 | |
| 19306 | codec->spec = spec; |
| 19307 | |
| 19308 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 19309 | alc680_models, |
| 19310 | alc680_cfg_tbl); |
| 19311 | |
| 19312 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 19313 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19314 | codec->chip_name); |
| 19315 | board_config = ALC680_AUTO; |
| 19316 | } |
| 19317 | |
| 19318 | if (board_config == ALC680_AUTO) { |
| 19319 | /* automatic parse from the BIOS config */ |
| 19320 | err = alc680_parse_auto_config(codec); |
| 19321 | if (err < 0) { |
| 19322 | alc_free(codec); |
| 19323 | return err; |
| 19324 | } else if (!err) { |
| 19325 | printk(KERN_INFO |
| 19326 | "hda_codec: Cannot set up configuration " |
| 19327 | "from BIOS. Using base mode...\n"); |
| 19328 | board_config = ALC680_BASE; |
| 19329 | } |
| 19330 | } |
| 19331 | |
| 19332 | if (board_config != ALC680_AUTO) |
| 19333 | setup_preset(codec, &alc680_presets[board_config]); |
| 19334 | |
| 19335 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
| 19336 | spec->stream_analog_capture = &alc680_pcm_analog_capture; |
| 19337 | spec->stream_analog_alt_capture = &alc680_pcm_analog_alt_capture; |
| 19338 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
| 19339 | |
| 19340 | if (!spec->adc_nids) { |
| 19341 | spec->adc_nids = alc680_adc_nids; |
| 19342 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 19343 | } |
| 19344 | |
| 19345 | if (!spec->cap_mixer) |
| 19346 | set_capture_mixer(codec); |
| 19347 | |
| 19348 | spec->vmaster_nid = 0x02; |
| 19349 | |
| 19350 | codec->patch_ops = alc_patch_ops; |
| 19351 | if (board_config == ALC680_AUTO) |
| 19352 | spec->init_hook = alc680_auto_init; |
| 19353 | |
| 19354 | return 0; |
| 19355 | } |
| 19356 | |
| 19357 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19358 | * patch entries |
| 19359 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19360 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19361 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19362 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19363 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 19364 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19365 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19366 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 19367 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19368 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19369 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19370 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19371 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 19372 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 19373 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19374 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19375 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19376 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 19377 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 19378 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19379 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19380 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19381 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19382 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19383 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19384 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 19385 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19386 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 19387 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19388 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19389 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19390 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 19391 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19392 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19393 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19394 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19395 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19396 | {} /* terminator */ |
| 19397 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19398 | |
| 19399 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 19400 | |
| 19401 | MODULE_LICENSE("GPL"); |
| 19402 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 19403 | |
| 19404 | static struct hda_codec_preset_list realtek_list = { |
| 19405 | .preset = snd_hda_preset_realtek, |
| 19406 | .owner = THIS_MODULE, |
| 19407 | }; |
| 19408 | |
| 19409 | static int __init patch_realtek_init(void) |
| 19410 | { |
| 19411 | return snd_hda_add_codec_preset(&realtek_list); |
| 19412 | } |
| 19413 | |
| 19414 | static void __exit patch_realtek_exit(void) |
| 19415 | { |
| 19416 | snd_hda_delete_codec_preset(&realtek_list); |
| 19417 | } |
| 19418 | |
| 19419 | module_init(patch_realtek_init) |
| 19420 | module_exit(patch_realtek_exit) |