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 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 6802 | static const struct alc_fixup alc260_fixups[] = { |
| 6803 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame^] | 6804 | .pins = (const struct alc_pincfg[]) { |
| 6805 | { 0x11, 0x90130110 }, /* speaker */ |
| 6806 | { } |
| 6807 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 6808 | }, |
| 6809 | }; |
| 6810 | |
| 6811 | static struct snd_pci_quirk alc260_fixup_tbl[] = { |
| 6812 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 6813 | {} |
| 6814 | }; |
| 6815 | |
| 6816 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6817 | * ALC260 configurations |
| 6818 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6819 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6820 | [ALC260_BASIC] = "basic", |
| 6821 | [ALC260_HP] = "hp", |
| 6822 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6823 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6824 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6825 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6826 | [ALC260_WILL] = "will", |
| 6827 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6828 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6829 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6830 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6831 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6832 | [ALC260_AUTO] = "auto", |
| 6833 | }; |
| 6834 | |
| 6835 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6836 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 6837 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6838 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6839 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6840 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 6841 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6842 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6843 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6844 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6845 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6846 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6847 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6848 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6849 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6850 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6851 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6852 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6853 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6854 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6855 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6856 | {} |
| 6857 | }; |
| 6858 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6859 | static struct alc_config_preset alc260_presets[] = { |
| 6860 | [ALC260_BASIC] = { |
| 6861 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6862 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6863 | .init_verbs = { alc260_init_verbs }, |
| 6864 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6865 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6866 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 6867 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6868 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6869 | .channel_mode = alc260_modes, |
| 6870 | .input_mux = &alc260_capture_source, |
| 6871 | }, |
| 6872 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6873 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6874 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6875 | .init_verbs = { alc260_init_verbs, |
| 6876 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6877 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6878 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6879 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6880 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6881 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6882 | .channel_mode = alc260_modes, |
| 6883 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6884 | .unsol_event = alc260_hp_unsol_event, |
| 6885 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6886 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6887 | [ALC260_HP_DC7600] = { |
| 6888 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6889 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6890 | .init_verbs = { alc260_init_verbs, |
| 6891 | alc260_hp_dc7600_verbs }, |
| 6892 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6893 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6894 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6895 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6896 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6897 | .channel_mode = alc260_modes, |
| 6898 | .input_mux = &alc260_capture_source, |
| 6899 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6900 | .init_hook = alc260_hp_3012_automute, |
| 6901 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6902 | [ALC260_HP_3013] = { |
| 6903 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6904 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6905 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6906 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6907 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6908 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6909 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6910 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6911 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6912 | .channel_mode = alc260_modes, |
| 6913 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6914 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6915 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6916 | }, |
| 6917 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6918 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6919 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6920 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6921 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6922 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6923 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6924 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6925 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6926 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6927 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6928 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6929 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6930 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6931 | .init_verbs = { alc260_acer_init_verbs }, |
| 6932 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6933 | .dac_nids = alc260_dac_nids, |
| 6934 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6935 | .adc_nids = alc260_dual_adc_nids, |
| 6936 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6937 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6938 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6939 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6940 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6941 | [ALC260_FAVORIT100] = { |
| 6942 | .mixers = { alc260_favorit100_mixer }, |
| 6943 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6944 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6945 | .dac_nids = alc260_dac_nids, |
| 6946 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6947 | .adc_nids = alc260_dual_adc_nids, |
| 6948 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6949 | .channel_mode = alc260_modes, |
| 6950 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6951 | .input_mux = alc260_favorit100_capture_sources, |
| 6952 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6953 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6954 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6955 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6956 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6957 | .dac_nids = alc260_dac_nids, |
| 6958 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6959 | .adc_nids = alc260_adc_nids, |
| 6960 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6961 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6962 | .channel_mode = alc260_modes, |
| 6963 | .input_mux = &alc260_capture_source, |
| 6964 | }, |
| 6965 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6966 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6967 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6968 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6969 | .dac_nids = alc260_dac_nids, |
| 6970 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6971 | .adc_nids = alc260_adc_nids, |
| 6972 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6973 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6974 | .channel_mode = alc260_modes, |
| 6975 | .input_mux = &alc260_capture_source, |
| 6976 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6977 | .init_hook = alc260_replacer_672v_automute, |
| 6978 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6979 | #ifdef CONFIG_SND_DEBUG |
| 6980 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6981 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6982 | .init_verbs = { alc260_test_init_verbs }, |
| 6983 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6984 | .dac_nids = alc260_test_dac_nids, |
| 6985 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6986 | .adc_nids = alc260_test_adc_nids, |
| 6987 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6988 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6989 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6990 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6991 | }, |
| 6992 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6993 | }; |
| 6994 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6995 | static int patch_alc260(struct hda_codec *codec) |
| 6996 | { |
| 6997 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6998 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6999 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7000 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7001 | if (spec == NULL) |
| 7002 | return -ENOMEM; |
| 7003 | |
| 7004 | codec->spec = spec; |
| 7005 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7006 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7007 | alc260_models, |
| 7008 | alc260_cfg_tbl); |
| 7009 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7010 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7011 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7012 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7013 | } |
| 7014 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7015 | if (board_config == ALC260_AUTO) |
| 7016 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1); |
| 7017 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7018 | if (board_config == ALC260_AUTO) { |
| 7019 | /* automatic parse from the BIOS config */ |
| 7020 | err = alc260_parse_auto_config(codec); |
| 7021 | if (err < 0) { |
| 7022 | alc_free(codec); |
| 7023 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7024 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7025 | printk(KERN_INFO |
| 7026 | "hda_codec: Cannot set up configuration " |
| 7027 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7028 | board_config = ALC260_BASIC; |
| 7029 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7030 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7031 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7032 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7033 | if (err < 0) { |
| 7034 | alc_free(codec); |
| 7035 | return err; |
| 7036 | } |
| 7037 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7038 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7039 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7040 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7041 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7042 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7043 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7044 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7045 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7046 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7047 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7048 | if (!spec->adc_nids && spec->input_mux) { |
| 7049 | /* check whether NID 0x04 is valid */ |
| 7050 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7051 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7052 | /* get type */ |
| 7053 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7054 | spec->adc_nids = alc260_adc_nids_alt; |
| 7055 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7056 | } else { |
| 7057 | spec->adc_nids = alc260_adc_nids; |
| 7058 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7059 | } |
| 7060 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7061 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7062 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7063 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7064 | if (board_config == ALC260_AUTO) |
| 7065 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0); |
| 7066 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7067 | spec->vmaster_nid = 0x08; |
| 7068 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7069 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7070 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7071 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7072 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7073 | if (!spec->loopback.amplist) |
| 7074 | spec->loopback.amplist = alc260_loopbacks; |
| 7075 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7076 | |
| 7077 | return 0; |
| 7078 | } |
| 7079 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7080 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7081 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7082 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7083 | * |
| 7084 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7085 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7086 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7087 | * 6-channel independent captures. |
| 7088 | * |
| 7089 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7090 | * driver yet). |
| 7091 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7092 | #define ALC882_DIGOUT_NID 0x06 |
| 7093 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7094 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7095 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7096 | #define ALC1200_DIGOUT_NID 0x10 |
| 7097 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7098 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7099 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7100 | { 8, NULL } |
| 7101 | }; |
| 7102 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7103 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7104 | static hda_nid_t alc882_dac_nids[4] = { |
| 7105 | /* front, rear, clfe, rear_surr */ |
| 7106 | 0x02, 0x03, 0x04, 0x05 |
| 7107 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7108 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7109 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7110 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7111 | #define alc882_adc_nids alc880_adc_nids |
| 7112 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7113 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7114 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7115 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7116 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7117 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7118 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7119 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7120 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7121 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7122 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7123 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7124 | /* input MUX */ |
| 7125 | /* FIXME: should be a matrix-type input source selection */ |
| 7126 | |
| 7127 | static struct hda_input_mux alc882_capture_source = { |
| 7128 | .num_items = 4, |
| 7129 | .items = { |
| 7130 | { "Mic", 0x0 }, |
| 7131 | { "Front Mic", 0x1 }, |
| 7132 | { "Line", 0x2 }, |
| 7133 | { "CD", 0x4 }, |
| 7134 | }, |
| 7135 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7136 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7137 | #define alc883_capture_source alc882_capture_source |
| 7138 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7139 | static struct hda_input_mux alc889_capture_source = { |
| 7140 | .num_items = 3, |
| 7141 | .items = { |
| 7142 | { "Front Mic", 0x0 }, |
| 7143 | { "Mic", 0x3 }, |
| 7144 | { "Line", 0x2 }, |
| 7145 | }, |
| 7146 | }; |
| 7147 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7148 | static struct hda_input_mux mb5_capture_source = { |
| 7149 | .num_items = 3, |
| 7150 | .items = { |
| 7151 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7152 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7153 | { "CD", 0x4 }, |
| 7154 | }, |
| 7155 | }; |
| 7156 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7157 | static struct hda_input_mux macmini3_capture_source = { |
| 7158 | .num_items = 2, |
| 7159 | .items = { |
| 7160 | { "Line", 0x2 }, |
| 7161 | { "CD", 0x4 }, |
| 7162 | }, |
| 7163 | }; |
| 7164 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7165 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7166 | .num_items = 4, |
| 7167 | .items = { |
| 7168 | { "Mic", 0x1 }, |
| 7169 | { "Front Mic", 0x0 }, |
| 7170 | { "Line", 0x2 }, |
| 7171 | { "CD", 0x4 }, |
| 7172 | }, |
| 7173 | }; |
| 7174 | |
| 7175 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7176 | .num_items = 2, |
| 7177 | .items = { |
| 7178 | { "Mic", 0x1 }, |
| 7179 | { "Line", 0x2 }, |
| 7180 | }, |
| 7181 | }; |
| 7182 | |
| 7183 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7184 | .num_items = 4, |
| 7185 | .items = { |
| 7186 | { "Mic", 0x0 }, |
David Henningsson | 150b432 | 2010-07-29 14:46:42 +0200 | [diff] [blame] | 7187 | { "Int Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7188 | { "Line", 0x2 }, |
| 7189 | { "CD", 0x4 }, |
| 7190 | }, |
| 7191 | }; |
| 7192 | |
| 7193 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7194 | .num_items = 2, |
| 7195 | .items = { |
| 7196 | { "Mic", 0x0 }, |
| 7197 | { "Int Mic", 0x1 }, |
| 7198 | }, |
| 7199 | }; |
| 7200 | |
| 7201 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7202 | .num_items = 3, |
| 7203 | .items = { |
| 7204 | { "Mic", 0x0 }, |
| 7205 | { "Front Mic", 0x1 }, |
| 7206 | { "Line", 0x4 }, |
| 7207 | }, |
| 7208 | }; |
| 7209 | |
| 7210 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7211 | .num_items = 2, |
| 7212 | .items = { |
| 7213 | { "Mic", 0x0 }, |
| 7214 | { "Line", 0x2 }, |
| 7215 | }, |
| 7216 | }; |
| 7217 | |
| 7218 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7219 | .num_items = 2, |
| 7220 | .items = { |
| 7221 | { "Mic", 0x0 }, |
| 7222 | /* Front Mic (0x01) unused */ |
| 7223 | { "Line", 0x2 }, |
| 7224 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7225 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7226 | }, |
| 7227 | }; |
| 7228 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7229 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7230 | .num_items = 2, |
| 7231 | .items = { |
| 7232 | { "Mic", 0x01 }, |
| 7233 | { "Line", 0x2 }, /* Not sure! */ |
| 7234 | }, |
| 7235 | }; |
| 7236 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7237 | /* |
| 7238 | * 2ch mode |
| 7239 | */ |
| 7240 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7241 | { 2, NULL } |
| 7242 | }; |
| 7243 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7244 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7245 | * 2ch mode |
| 7246 | */ |
| 7247 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7248 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7249 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7250 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7251 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7252 | { } /* end */ |
| 7253 | }; |
| 7254 | |
| 7255 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7256 | * 4ch mode |
| 7257 | */ |
| 7258 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7259 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7260 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7261 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7262 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7263 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7264 | { } /* end */ |
| 7265 | }; |
| 7266 | |
| 7267 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7268 | * 6ch mode |
| 7269 | */ |
| 7270 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7271 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7272 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7273 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7274 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7275 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7276 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7277 | { } /* end */ |
| 7278 | }; |
| 7279 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7280 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7281 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7282 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7283 | { 6, alc882_3ST_ch6_init }, |
| 7284 | }; |
| 7285 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7286 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7287 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7288 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7289 | * 2ch mode |
| 7290 | */ |
| 7291 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7292 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7293 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7294 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7295 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7296 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7297 | { } /* end */ |
| 7298 | }; |
| 7299 | |
| 7300 | /* |
| 7301 | * 4ch mode |
| 7302 | */ |
| 7303 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7304 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7305 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7306 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7307 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7308 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7309 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7310 | { } /* end */ |
| 7311 | }; |
| 7312 | |
| 7313 | /* |
| 7314 | * 6ch mode |
| 7315 | */ |
| 7316 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7317 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7318 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7319 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7320 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7321 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7322 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7323 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7324 | { } /* end */ |
| 7325 | }; |
| 7326 | |
| 7327 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7328 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7329 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7330 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7331 | }; |
| 7332 | |
| 7333 | |
| 7334 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7335 | * 6ch mode |
| 7336 | */ |
| 7337 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7338 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7339 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7340 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7341 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7342 | { } /* end */ |
| 7343 | }; |
| 7344 | |
| 7345 | /* |
| 7346 | * 8ch mode |
| 7347 | */ |
| 7348 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7349 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7350 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7351 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7352 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7353 | { } /* end */ |
| 7354 | }; |
| 7355 | |
| 7356 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7357 | { 6, alc882_sixstack_ch6_init }, |
| 7358 | { 8, alc882_sixstack_ch8_init }, |
| 7359 | }; |
| 7360 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7361 | |
| 7362 | /* Macbook Air 2,1 */ |
| 7363 | |
| 7364 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7365 | { 2, NULL }, |
| 7366 | }; |
| 7367 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7368 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7369 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7370 | */ |
| 7371 | |
| 7372 | /* |
| 7373 | * 2ch mode |
| 7374 | */ |
| 7375 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7376 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7377 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7378 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7379 | { } /* end */ |
| 7380 | }; |
| 7381 | |
| 7382 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7383 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7384 | */ |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7385 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7386 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7387 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7388 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7389 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7390 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7391 | { } /* end */ |
| 7392 | }; |
| 7393 | |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7394 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7395 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7396 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7397 | }; |
| 7398 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7399 | /* |
| 7400 | * 2ch |
| 7401 | * Speakers/Woofer/HP = Front |
| 7402 | * LineIn = Input |
| 7403 | */ |
| 7404 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7405 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7406 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7407 | { } /* end */ |
| 7408 | }; |
| 7409 | |
| 7410 | /* |
| 7411 | * 6ch mode |
| 7412 | * Speakers/HP = Front |
| 7413 | * Woofer = LFE |
| 7414 | * LineIn = Surround |
| 7415 | */ |
| 7416 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7417 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7418 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7419 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7420 | { } /* end */ |
| 7421 | }; |
| 7422 | |
| 7423 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7424 | { 2, alc885_mb5_ch2_init }, |
| 7425 | { 6, alc885_mb5_ch6_init }, |
| 7426 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7427 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7428 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7429 | |
| 7430 | /* |
| 7431 | * 2ch mode |
| 7432 | */ |
| 7433 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7434 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7435 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7436 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7437 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7438 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7439 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7440 | { } /* end */ |
| 7441 | }; |
| 7442 | |
| 7443 | /* |
| 7444 | * 4ch mode |
| 7445 | */ |
| 7446 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7447 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7448 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7449 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7450 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7451 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7452 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7453 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7454 | { } /* end */ |
| 7455 | }; |
| 7456 | |
| 7457 | /* |
| 7458 | * 6ch mode |
| 7459 | */ |
| 7460 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7461 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7462 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7463 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7464 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7465 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7466 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7467 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7468 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7469 | { } /* end */ |
| 7470 | }; |
| 7471 | |
| 7472 | /* |
| 7473 | * 8ch mode |
| 7474 | */ |
| 7475 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7476 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7477 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7478 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7479 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7480 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7481 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7482 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7483 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7484 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7485 | { } /* end */ |
| 7486 | }; |
| 7487 | |
| 7488 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7489 | { 2, alc883_4ST_ch2_init }, |
| 7490 | { 4, alc883_4ST_ch4_init }, |
| 7491 | { 6, alc883_4ST_ch6_init }, |
| 7492 | { 8, alc883_4ST_ch8_init }, |
| 7493 | }; |
| 7494 | |
| 7495 | |
| 7496 | /* |
| 7497 | * 2ch mode |
| 7498 | */ |
| 7499 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7500 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7501 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7502 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7503 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7504 | { } /* end */ |
| 7505 | }; |
| 7506 | |
| 7507 | /* |
| 7508 | * 4ch mode |
| 7509 | */ |
| 7510 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7511 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7512 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7513 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7514 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7515 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7516 | { } /* end */ |
| 7517 | }; |
| 7518 | |
| 7519 | /* |
| 7520 | * 6ch mode |
| 7521 | */ |
| 7522 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7523 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7524 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7525 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7526 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7527 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7528 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7529 | { } /* end */ |
| 7530 | }; |
| 7531 | |
| 7532 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7533 | { 2, alc883_3ST_ch2_intel_init }, |
| 7534 | { 4, alc883_3ST_ch4_intel_init }, |
| 7535 | { 6, alc883_3ST_ch6_intel_init }, |
| 7536 | }; |
| 7537 | |
| 7538 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7539 | * 2ch mode |
| 7540 | */ |
| 7541 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7542 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7543 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7544 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7545 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7546 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7547 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7548 | { } /* end */ |
| 7549 | }; |
| 7550 | |
| 7551 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7552 | * 6ch mode |
| 7553 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7554 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7555 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7556 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7557 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7558 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7559 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7560 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7561 | { } /* end */ |
| 7562 | }; |
| 7563 | |
| 7564 | /* |
| 7565 | * 8ch mode |
| 7566 | */ |
| 7567 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7568 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7569 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7570 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7571 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7572 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7573 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7574 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7575 | { } /* end */ |
| 7576 | }; |
| 7577 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7578 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7579 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7580 | { 6, alc889_ch6_intel_init }, |
| 7581 | { 8, alc889_ch8_intel_init }, |
| 7582 | }; |
| 7583 | |
| 7584 | /* |
| 7585 | * 6ch mode |
| 7586 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7587 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7588 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7589 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7590 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7591 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7592 | { } /* end */ |
| 7593 | }; |
| 7594 | |
| 7595 | /* |
| 7596 | * 8ch mode |
| 7597 | */ |
| 7598 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7599 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7600 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7601 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7602 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7603 | { } /* end */ |
| 7604 | }; |
| 7605 | |
| 7606 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7607 | { 6, alc883_sixstack_ch6_init }, |
| 7608 | { 8, alc883_sixstack_ch8_init }, |
| 7609 | }; |
| 7610 | |
| 7611 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7612 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7613 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7614 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7615 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7616 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7617 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7618 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7619 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7620 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7621 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7622 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7623 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7624 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7625 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7626 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7627 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7628 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7629 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7630 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7631 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7632 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7633 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7634 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7635 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7636 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7637 | { } /* end */ |
| 7638 | }; |
| 7639 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7640 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 7641 | |
| 7642 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 7643 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7644 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 7645 | { } |
| 7646 | }; |
| 7647 | |
| 7648 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7649 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7650 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7651 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7652 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7653 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7654 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7655 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7656 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7657 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7658 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7659 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7660 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7661 | { } /* end */ |
| 7662 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7663 | |
| 7664 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7665 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7666 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7667 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7668 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7669 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7670 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7671 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7672 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7673 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7674 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7675 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7676 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7677 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7678 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7679 | { } /* end */ |
| 7680 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7681 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7682 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 7683 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7684 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7685 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7686 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7687 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7688 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7689 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7690 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 7691 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7692 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 7693 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7694 | { } /* end */ |
| 7695 | }; |
| 7696 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7697 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7698 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7699 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7700 | { } /* end */ |
| 7701 | }; |
| 7702 | |
| 7703 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7704 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7705 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7706 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7707 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7708 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7709 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7710 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7711 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7712 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7713 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7714 | { } /* end */ |
| 7715 | }; |
| 7716 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7717 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7718 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7719 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7720 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7721 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7722 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7723 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7724 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7725 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7726 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7727 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7728 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7729 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7730 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7731 | { } /* end */ |
| 7732 | }; |
| 7733 | |
| 7734 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7735 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7736 | */ |
| 7737 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7738 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7739 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7740 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7741 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7742 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7743 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7744 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7745 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7746 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7747 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7748 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7749 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7750 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7751 | { } /* end */ |
| 7752 | }; |
| 7753 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7754 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7755 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7756 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7757 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7758 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7759 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7760 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7761 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7762 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7763 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7764 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7765 | { } /* end */ |
| 7766 | }; |
| 7767 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7768 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7769 | { |
| 7770 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7771 | .name = "Channel Mode", |
| 7772 | .info = alc_ch_mode_info, |
| 7773 | .get = alc_ch_mode_get, |
| 7774 | .put = alc_ch_mode_put, |
| 7775 | }, |
| 7776 | { } /* end */ |
| 7777 | }; |
| 7778 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7779 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7780 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7781 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7782 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7783 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7784 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7785 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7786 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7787 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7788 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7789 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7790 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7791 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7792 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7793 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7794 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7795 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7796 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7797 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7798 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7799 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7800 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7801 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7802 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7803 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7804 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7805 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7806 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7807 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7808 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7809 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7810 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7811 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7812 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7813 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7814 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7815 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7816 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7817 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7818 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7819 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7820 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7821 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7822 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7823 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7824 | |
| 7825 | /* FIXME: use matrix-type input source selection */ |
| 7826 | /* 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] | 7827 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7828 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7829 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7830 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7831 | /* ADC2: mute amp left and right */ |
| 7832 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7833 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7834 | /* ADC3: mute amp left and right */ |
| 7835 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7836 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7837 | |
| 7838 | { } |
| 7839 | }; |
| 7840 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7841 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7842 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7843 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7844 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7845 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7846 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7847 | /* ADC1: mute amp left and right */ |
| 7848 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7849 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7850 | { } |
| 7851 | }; |
| 7852 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7853 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7854 | /* change to EAPD mode */ |
| 7855 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7856 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7857 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7858 | }; |
| 7859 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7860 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7861 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7862 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7863 | { } |
| 7864 | }; |
| 7865 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7866 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7867 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7868 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7869 | {} |
| 7870 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7871 | |
| 7872 | static struct hda_verb alc885_init_verbs[] = { |
| 7873 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7874 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7875 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7876 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7877 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7878 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7879 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7880 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7881 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7882 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7883 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7884 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7885 | |
| 7886 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7887 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7888 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7889 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7890 | /* Front Pin: output 0 (0x0c) */ |
| 7891 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7892 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7893 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7894 | /* Rear Pin: output 1 (0x0d) */ |
| 7895 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7896 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7897 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7898 | /* CLFE Pin: output 2 (0x0e) */ |
| 7899 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7900 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7901 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7902 | /* Side Pin: output 3 (0x0f) */ |
| 7903 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7904 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7905 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7906 | /* Mic (rear) pin: input vref at 80% */ |
| 7907 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7908 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7909 | /* Front Mic pin: input vref at 80% */ |
| 7910 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7911 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7912 | /* Line In pin: input */ |
| 7913 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7914 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7915 | |
| 7916 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7917 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7918 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7919 | /* Input mixer2 */ |
| 7920 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7921 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7922 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7923 | /* ADC2: mute amp left and right */ |
| 7924 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7925 | /* ADC3: mute amp left and right */ |
| 7926 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7927 | |
| 7928 | { } |
| 7929 | }; |
| 7930 | |
| 7931 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7932 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7933 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7934 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7935 | { } |
| 7936 | }; |
| 7937 | |
| 7938 | |
| 7939 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7940 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7941 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7942 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7943 | { } |
| 7944 | }; |
| 7945 | |
| 7946 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7947 | #define alc883_init_verbs alc882_base_init_verbs |
| 7948 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7949 | /* Mac Pro test */ |
| 7950 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7951 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7952 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7953 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7954 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7955 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7956 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 7957 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7958 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7959 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7960 | { } /* end */ |
| 7961 | }; |
| 7962 | |
| 7963 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7964 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7965 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7966 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7967 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7968 | /* Front Pin: output 0 (0x0c) */ |
| 7969 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7970 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7971 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7972 | /* Front Mic pin: input vref at 80% */ |
| 7973 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7974 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7975 | /* Speaker: output */ |
| 7976 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7977 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7978 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7979 | /* Headphone output (output 0 - 0x0c) */ |
| 7980 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7981 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7982 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7983 | |
| 7984 | /* FIXME: use matrix-type input source selection */ |
| 7985 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7986 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7987 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7988 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7989 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7990 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7991 | /* Input mixer2 */ |
| 7992 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7993 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7994 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7995 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7996 | /* Input mixer3 */ |
| 7997 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7998 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7999 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8000 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8001 | /* ADC1: mute amp left and right */ |
| 8002 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8003 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8004 | /* ADC2: mute amp left and right */ |
| 8005 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8006 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8007 | /* ADC3: mute amp left and right */ |
| 8008 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8009 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8010 | |
| 8011 | { } |
| 8012 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8013 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8014 | /* Macbook 5,1 */ |
| 8015 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8016 | /* DACs */ |
| 8017 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8018 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8019 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8020 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8021 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8022 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8023 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8024 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8025 | /* Surround mixer */ |
| 8026 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8027 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8028 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8029 | /* LFE mixer */ |
| 8030 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8031 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8032 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8033 | /* HP mixer */ |
| 8034 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8035 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8036 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8037 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8038 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8039 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8040 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8041 | /* LFE Pin (0x0e) */ |
| 8042 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8043 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8044 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8045 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8046 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8047 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8048 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8049 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8050 | /* Front Mic pin: input vref at 80% */ |
| 8051 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8052 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8053 | /* Line In pin */ |
| 8054 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8055 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8056 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8057 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8058 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8059 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8060 | { } |
| 8061 | }; |
| 8062 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8063 | /* Macmini 3,1 */ |
| 8064 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 8065 | /* DACs */ |
| 8066 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8067 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8068 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8069 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8070 | /* Front mixer */ |
| 8071 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8072 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8073 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8074 | /* Surround mixer */ |
| 8075 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8076 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8077 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8078 | /* LFE mixer */ |
| 8079 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8080 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8081 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8082 | /* HP mixer */ |
| 8083 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8084 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8085 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8086 | /* Front Pin (0x0c) */ |
| 8087 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8088 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8089 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8090 | /* LFE Pin (0x0e) */ |
| 8091 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8092 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8093 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8094 | /* HP Pin (0x0f) */ |
| 8095 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8096 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8097 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8098 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8099 | /* Line In pin */ |
| 8100 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8101 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8102 | |
| 8103 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8104 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8105 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8106 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8107 | { } |
| 8108 | }; |
| 8109 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8110 | |
| 8111 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8112 | /*Internal and HP Speaker Mixer*/ |
| 8113 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8114 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8115 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8116 | /*Internal Speaker Pin (0x0c)*/ |
| 8117 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8118 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8119 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8120 | /* HP Pin: output 0 (0x0e) */ |
| 8121 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8122 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8123 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8124 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8125 | /* Line in (is hp when jack connected)*/ |
| 8126 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8127 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8128 | |
| 8129 | { } |
| 8130 | }; |
| 8131 | |
| 8132 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8133 | /* Macbook Pro rev3 */ |
| 8134 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8135 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8136 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8137 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8138 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8139 | /* Rear mixer */ |
| 8140 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8141 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8142 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8143 | /* HP mixer */ |
| 8144 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8145 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8146 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8147 | /* Front Pin: output 0 (0x0c) */ |
| 8148 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8149 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8150 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8151 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8152 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8153 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8154 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8155 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8156 | /* Mic (rear) pin: input vref at 80% */ |
| 8157 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8158 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8159 | /* Front Mic pin: input vref at 80% */ |
| 8160 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8161 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8162 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8163 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8164 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8165 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8166 | |
| 8167 | /* FIXME: use matrix-type input source selection */ |
| 8168 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8169 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8170 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8171 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8172 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8173 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8174 | /* Input mixer2 */ |
| 8175 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8176 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8177 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8178 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8179 | /* Input mixer3 */ |
| 8180 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8181 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8182 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8183 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8184 | /* ADC1: mute amp left and right */ |
| 8185 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8186 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8187 | /* ADC2: mute amp left and right */ |
| 8188 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8189 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8190 | /* ADC3: mute amp left and right */ |
| 8191 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8192 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8193 | |
| 8194 | { } |
| 8195 | }; |
| 8196 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8197 | /* iMac 9,1 */ |
| 8198 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8199 | /* Internal Speaker Pin (0x0c) */ |
| 8200 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8201 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8202 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8203 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8204 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8205 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8206 | /* HP Pin: Rear */ |
| 8207 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8208 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8209 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8210 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8211 | /* Line in Rear */ |
| 8212 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8213 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8214 | /* Front Mic pin: input vref at 80% */ |
| 8215 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8216 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8217 | /* Rear mixer */ |
| 8218 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8219 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8220 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8221 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8222 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8223 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8224 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8225 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8226 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8227 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8228 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8229 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8230 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8231 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8232 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8233 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8234 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8235 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8236 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8237 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8238 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8239 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8240 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8241 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8242 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8243 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8244 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8245 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8246 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8247 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8248 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8249 | { } |
| 8250 | }; |
| 8251 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8252 | /* iMac 24 mixer. */ |
| 8253 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8254 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8255 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8256 | { } /* end */ |
| 8257 | }; |
| 8258 | |
| 8259 | /* iMac 24 init verbs. */ |
| 8260 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8261 | /* Internal speakers: output 0 (0x0c) */ |
| 8262 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8263 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8264 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8265 | /* Internal speakers: output 0 (0x0c) */ |
| 8266 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8267 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8268 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8269 | /* Headphone: output 0 (0x0c) */ |
| 8270 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8271 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8272 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8273 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8274 | /* Front Mic: input vref at 80% */ |
| 8275 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8276 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8277 | { } |
| 8278 | }; |
| 8279 | |
| 8280 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8281 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8282 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8283 | struct alc_spec *spec = codec->spec; |
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 | spec->autocfg.hp_pins[0] = 0x14; |
| 8286 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8287 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8288 | } |
| 8289 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8290 | #define alc885_mb5_setup alc885_imac24_setup |
| 8291 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8292 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8293 | /* Macbook Air 2,1 */ |
| 8294 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8295 | { |
| 8296 | struct alc_spec *spec = codec->spec; |
| 8297 | |
| 8298 | spec->autocfg.hp_pins[0] = 0x14; |
| 8299 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8300 | } |
| 8301 | |
| 8302 | |
| 8303 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8304 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8305 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8306 | struct alc_spec *spec = codec->spec; |
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 | spec->autocfg.hp_pins[0] = 0x15; |
| 8309 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8310 | } |
| 8311 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8312 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8313 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8314 | struct alc_spec *spec = codec->spec; |
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 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8317 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8318 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8319 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8320 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8321 | static struct hda_verb alc882_targa_verbs[] = { |
| 8322 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8323 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8324 | |
| 8325 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8326 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8327 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8328 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8329 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8330 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8331 | |
| 8332 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8333 | { } /* end */ |
| 8334 | }; |
| 8335 | |
| 8336 | /* toggle speaker-output according to the hp-jack state */ |
| 8337 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8338 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8339 | struct alc_spec *spec = codec->spec; |
| 8340 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8341 | 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] | 8342 | spec->jack_present ? 1 : 3); |
| 8343 | } |
| 8344 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8345 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8346 | { |
| 8347 | struct alc_spec *spec = codec->spec; |
| 8348 | |
| 8349 | spec->autocfg.hp_pins[0] = 0x14; |
| 8350 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8351 | } |
| 8352 | |
| 8353 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8354 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8355 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8356 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8357 | } |
| 8358 | |
| 8359 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8360 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8361 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8362 | |
| 8363 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8364 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8365 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8366 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8367 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8368 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8369 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8370 | |
| 8371 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8372 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8373 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8374 | { } /* end */ |
| 8375 | }; |
| 8376 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8377 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8378 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8379 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8380 | |
| 8381 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8382 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8383 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8384 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8385 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8386 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8387 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8388 | |
| 8389 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8390 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8391 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8392 | { } /* end */ |
| 8393 | }; |
| 8394 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8395 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8396 | { |
| 8397 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8398 | |
| 8399 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8400 | AC_VERB_GET_GPIO_DATA, 0); |
| 8401 | |
| 8402 | if (!muted) |
| 8403 | gpiostate |= (1 << pin); |
| 8404 | else |
| 8405 | gpiostate &= ~(1 << pin); |
| 8406 | |
| 8407 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8408 | AC_VERB_GET_GPIO_MASK, 0); |
| 8409 | gpiomask |= (1 << pin); |
| 8410 | |
| 8411 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8412 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8413 | gpiodir |= (1 << pin); |
| 8414 | |
| 8415 | |
| 8416 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8417 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8418 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8419 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8420 | |
| 8421 | msleep(1); |
| 8422 | |
| 8423 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8424 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8425 | } |
| 8426 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8427 | /* set up GPIO at initialization */ |
| 8428 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8429 | { |
| 8430 | alc882_gpio_mute(codec, 0, 0); |
| 8431 | alc882_gpio_mute(codec, 1, 0); |
| 8432 | } |
| 8433 | |
| 8434 | /* set up GPIO and update auto-muting at initialization */ |
| 8435 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8436 | { |
| 8437 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8438 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8439 | } |
| 8440 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8441 | /* |
| 8442 | * generic initialization of ADC, input mixers and output mixers |
| 8443 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8444 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8445 | /* |
| 8446 | * Unmute ADC0-2 and set the default input to mic-in |
| 8447 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8448 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8449 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8450 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8451 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8452 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8453 | /* |
| 8454 | * Set up output mixers (0x0c - 0x0f) |
| 8455 | */ |
| 8456 | /* set vol=0 to output mixers */ |
| 8457 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8458 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8459 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8460 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8461 | /* set up input amps for analog loopback */ |
| 8462 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8463 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8464 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8465 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8466 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8467 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8468 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8469 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8470 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8471 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8472 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8473 | |
| 8474 | /* FIXME: use matrix-type input source selection */ |
| 8475 | /* 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] | 8476 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8477 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8478 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8479 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8480 | { } |
| 8481 | }; |
| 8482 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8483 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8484 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8485 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8486 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8487 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8488 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8489 | { } /* end */ |
| 8490 | }; |
| 8491 | |
| 8492 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8493 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8494 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8495 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8496 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8497 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8498 | { } /* end */ |
| 8499 | }; |
| 8500 | |
| 8501 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8502 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8503 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8504 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8505 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8506 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8507 | { } /* end */ |
| 8508 | }; |
| 8509 | |
| 8510 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8511 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8512 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8513 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8514 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8515 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8516 | { } /* end */ |
| 8517 | }; |
| 8518 | |
| 8519 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8520 | { 2, alc889A_mb31_ch2_init }, |
| 8521 | { 4, alc889A_mb31_ch4_init }, |
| 8522 | { 5, alc889A_mb31_ch5_init }, |
| 8523 | { 6, alc889A_mb31_ch6_init }, |
| 8524 | }; |
| 8525 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8526 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8527 | /* eanable EAPD on medion laptop */ |
| 8528 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8529 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8530 | { } |
| 8531 | }; |
| 8532 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8533 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8534 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8535 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8536 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8537 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8538 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8539 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8540 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8541 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8542 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8543 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8544 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8545 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8546 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8547 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8548 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8549 | { } /* end */ |
| 8550 | }; |
| 8551 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8552 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8553 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8554 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8555 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8556 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8557 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8558 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8559 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8560 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8561 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8562 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8563 | { } /* end */ |
| 8564 | }; |
| 8565 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8566 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8567 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8568 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8569 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8570 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8571 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8572 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8573 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8574 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8575 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8576 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8577 | { } /* end */ |
| 8578 | }; |
| 8579 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8580 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8581 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8582 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8583 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8584 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8585 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8586 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8587 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8588 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8589 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8590 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8591 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8592 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8593 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8594 | { } /* end */ |
| 8595 | }; |
| 8596 | |
| 8597 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8598 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8599 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8600 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8601 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8602 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8603 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8604 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8605 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8606 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8607 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8608 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8609 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8610 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8611 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8612 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8613 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8614 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8615 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8616 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8617 | { } /* end */ |
| 8618 | }; |
| 8619 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8620 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8621 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8622 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8623 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8624 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8625 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8626 | HDA_OUTPUT), |
| 8627 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8628 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8629 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8630 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8631 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8632 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8633 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8634 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8635 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8636 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8637 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8638 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8639 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8640 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8641 | { } /* end */ |
| 8642 | }; |
| 8643 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8644 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8645 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8646 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8647 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8648 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8649 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8650 | HDA_OUTPUT), |
| 8651 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8652 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8653 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8654 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8655 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8656 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8657 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8658 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8659 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 8660 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 8661 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8662 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8663 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8664 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8665 | { } /* end */ |
| 8666 | }; |
| 8667 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8668 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8669 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8670 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8671 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8672 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8673 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8674 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8675 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8676 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8677 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8678 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8679 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8680 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8681 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8682 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8683 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8684 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8685 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8686 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8687 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8688 | { } /* end */ |
| 8689 | }; |
| 8690 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8691 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8692 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8693 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8694 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8695 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8696 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8697 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8698 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8699 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8700 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8701 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8702 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8703 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8704 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8705 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8706 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8707 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8708 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8709 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8710 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8711 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8712 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8713 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8714 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8715 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8716 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8717 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8718 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8719 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8720 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8721 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8722 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8723 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8724 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8725 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8726 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8727 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8728 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 8729 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8730 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8731 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8732 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8733 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8734 | { } /* end */ |
| 8735 | }; |
| 8736 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8737 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8738 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8739 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8740 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8741 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8742 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8743 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8744 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8745 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8746 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8747 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8748 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8749 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8750 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8751 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8752 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8753 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8754 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8755 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8756 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 150b432 | 2010-07-29 14:46:42 +0200 | [diff] [blame] | 8757 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8758 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8759 | { } /* end */ |
| 8760 | }; |
| 8761 | |
| 8762 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8763 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8764 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8765 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8766 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8767 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8768 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8769 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8770 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8771 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8772 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8773 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8774 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 8775 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 8776 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8777 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8778 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8779 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 8780 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 8781 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 8782 | { } /* end */ |
| 8783 | }; |
| 8784 | |
| 8785 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 8786 | /* Unmute front mixer */ |
| 8787 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8788 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8789 | |
| 8790 | /* Set speaker pin to front mixer */ |
| 8791 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8792 | |
| 8793 | /* Init headphone pin */ |
| 8794 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8795 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8796 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8797 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8798 | |
| 8799 | { } /* end */ |
| 8800 | }; |
| 8801 | |
| 8802 | /* toggle speaker-output according to the hp-jack state */ |
| 8803 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 8804 | { |
| 8805 | struct alc_spec *spec = codec->spec; |
| 8806 | |
| 8807 | spec->autocfg.hp_pins[0] = 0x1a; |
| 8808 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8809 | } |
| 8810 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8811 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8812 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8813 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8814 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8815 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8816 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8817 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8818 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8819 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8820 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8821 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8822 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8823 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8824 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8825 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 8826 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8827 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8828 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8829 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8830 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8831 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8832 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8833 | { } /* end */ |
| 8834 | }; |
| 8835 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8836 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8837 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8838 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8839 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8840 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8841 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8842 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8843 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8844 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8845 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8846 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8847 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8848 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8849 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8850 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8851 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8852 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8853 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8854 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8855 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8856 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8857 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8858 | { } /* end */ |
| 8859 | }; |
| 8860 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8861 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8862 | /* Output mixers */ |
| 8863 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8864 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8865 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8866 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8867 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8868 | HDA_OUTPUT), |
| 8869 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8870 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8871 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8872 | /* Output switches */ |
| 8873 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8874 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8875 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8876 | /* Boost mixers */ |
| 8877 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8878 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8879 | /* Input mixers */ |
| 8880 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8881 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8882 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8883 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8884 | { } /* end */ |
| 8885 | }; |
| 8886 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8887 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8888 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8889 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8890 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8891 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8892 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8893 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8894 | { } /* end */ |
| 8895 | }; |
| 8896 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8897 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8898 | .ops = &snd_hda_bind_vol, |
| 8899 | .values = { |
| 8900 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8901 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8902 | 0 |
| 8903 | }, |
| 8904 | }; |
| 8905 | |
| 8906 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8907 | .ops = &snd_hda_bind_sw, |
| 8908 | .values = { |
| 8909 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8910 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8911 | 0 |
| 8912 | }, |
| 8913 | }; |
| 8914 | |
| 8915 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8916 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8917 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8918 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8919 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8920 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8921 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8922 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8923 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8924 | { } /* end */ |
| 8925 | }; |
| 8926 | |
| 8927 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8928 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8929 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8930 | { |
| 8931 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8932 | /* .name = "Capture Source", */ |
| 8933 | .name = "Input Source", |
| 8934 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8935 | .info = alc_mux_enum_info, |
| 8936 | .get = alc_mux_enum_get, |
| 8937 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8938 | }, |
| 8939 | { } /* end */ |
| 8940 | }; |
| 8941 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8942 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8943 | { |
| 8944 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8945 | .name = "Channel Mode", |
| 8946 | .info = alc_ch_mode_info, |
| 8947 | .get = alc_ch_mode_get, |
| 8948 | .put = alc_ch_mode_put, |
| 8949 | }, |
| 8950 | { } /* end */ |
| 8951 | }; |
| 8952 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8953 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8954 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8955 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8956 | struct alc_spec *spec = codec->spec; |
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 | spec->autocfg.hp_pins[0] = 0x15; |
| 8959 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8960 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8961 | } |
| 8962 | |
| 8963 | /* auto-toggle front mic */ |
| 8964 | /* |
| 8965 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8966 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8967 | 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] | 8968 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8969 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8970 | } |
| 8971 | */ |
| 8972 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8973 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8974 | /* HP */ |
| 8975 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8976 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8977 | /* Subwoofer */ |
| 8978 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8979 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8980 | |
| 8981 | /* enable unsolicited event */ |
| 8982 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8983 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8984 | |
| 8985 | { } /* end */ |
| 8986 | }; |
| 8987 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8988 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 8989 | /* HP */ |
| 8990 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8991 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8992 | /* Int speaker */ |
| 8993 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 8994 | |
| 8995 | /* enable unsolicited event */ |
| 8996 | /* |
| 8997 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8998 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8999 | */ |
| 9000 | |
| 9001 | { } /* end */ |
| 9002 | }; |
| 9003 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9004 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9005 | /* HP */ |
| 9006 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9007 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9008 | /* Int speaker */ |
| 9009 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9010 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9011 | |
| 9012 | /* enable unsolicited event */ |
| 9013 | {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] | 9014 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9015 | |
| 9016 | { } /* end */ |
| 9017 | }; |
| 9018 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9019 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 9020 | /* HP */ |
| 9021 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9022 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9023 | /* Subwoofer */ |
| 9024 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9025 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9026 | |
| 9027 | /* enable unsolicited event */ |
| 9028 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9029 | |
| 9030 | { } /* end */ |
| 9031 | }; |
| 9032 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9033 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9034 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9035 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9036 | |
| 9037 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9038 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9039 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9040 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9041 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9042 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9043 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9044 | /* Connect Mic jack to CLFE */ |
| 9045 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9046 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9047 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9048 | /* Connect Line-in jack to Surround */ |
| 9049 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9050 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9051 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9052 | /* Connect HP out jack to Front */ |
| 9053 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9054 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9055 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9056 | |
| 9057 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9058 | |
| 9059 | { } /* end */ |
| 9060 | }; |
| 9061 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9062 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 9063 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9064 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9065 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9066 | { } /* end */ |
| 9067 | }; |
| 9068 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9069 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 9070 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9071 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9072 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9073 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9074 | { } /* end */ |
| 9075 | }; |
| 9076 | |
| 9077 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 9078 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9079 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9080 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9081 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9082 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9083 | { } /* end */ |
| 9084 | }; |
| 9085 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9086 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 9087 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9088 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9089 | |
| 9090 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9091 | |
| 9092 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9093 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9094 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9095 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9096 | { } /* end */ |
| 9097 | }; |
| 9098 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9099 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9100 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9101 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9102 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9103 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9104 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9105 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9106 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9107 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9108 | { } /* end */ |
| 9109 | }; |
| 9110 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9111 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9112 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9113 | { } |
| 9114 | }; |
| 9115 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9116 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9117 | /* HP */ |
| 9118 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9119 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9120 | |
| 9121 | /* enable unsolicited event */ |
| 9122 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9123 | |
| 9124 | { } /* end */ |
| 9125 | }; |
| 9126 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9127 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9128 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9129 | struct alc_spec *spec = codec->spec; |
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 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9132 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9133 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9134 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9135 | } |
| 9136 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9137 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9138 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9139 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9140 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9141 | {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] | 9142 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9143 | }; |
| 9144 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9145 | /* |
| 9146 | * 2ch mode |
| 9147 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9148 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9149 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9150 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9151 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9152 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9153 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9154 | }; |
| 9155 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9156 | /* |
| 9157 | * 4ch mode |
| 9158 | */ |
| 9159 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9160 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9161 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9162 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9163 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9164 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9165 | { } /* end */ |
| 9166 | }; |
| 9167 | |
| 9168 | /* |
| 9169 | * 6ch mode |
| 9170 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9171 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9172 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9173 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9174 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9175 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9176 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9177 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9178 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9179 | }; |
| 9180 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9181 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9182 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9183 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9184 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9185 | }; |
| 9186 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9187 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 9188 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 9189 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9190 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9191 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9192 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9193 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9194 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9195 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9196 | } |
| 9197 | |
| 9198 | /* toggle RCA according to the front-jack state */ |
| 9199 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 9200 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9201 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9202 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9203 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9204 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9205 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9206 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9207 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 9208 | unsigned int res) |
| 9209 | { |
| 9210 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9211 | alc888_lenovo_ms7195_front_automute(codec); |
| 9212 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9213 | alc888_lenovo_ms7195_rca_automute(codec); |
| 9214 | } |
| 9215 | |
| 9216 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 9217 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9218 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9219 | |
| 9220 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9221 | |
| 9222 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9223 | { } /* end */ |
| 9224 | }; |
| 9225 | |
| 9226 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9227 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9228 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9229 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9230 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9231 | spec->autocfg.hp_pins[0] = 0x14; |
| 9232 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9233 | } |
| 9234 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9235 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9236 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9237 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9238 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9239 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 9240 | { |
| 9241 | unsigned int present; |
| 9242 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 9243 | present = snd_hda_jack_detect(codec, 0x18); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9244 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 9245 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9246 | } |
| 9247 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9248 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9249 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9250 | struct alc_spec *spec = codec->spec; |
| 9251 | |
| 9252 | spec->autocfg.hp_pins[0] = 0x15; |
| 9253 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9254 | } |
| 9255 | |
| 9256 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9257 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9258 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9259 | alc883_clevo_m720_mic_automute(codec); |
| 9260 | } |
| 9261 | |
| 9262 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9263 | unsigned int res) |
| 9264 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9265 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9266 | case ALC880_MIC_EVENT: |
| 9267 | alc883_clevo_m720_mic_automute(codec); |
| 9268 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9269 | default: |
| 9270 | alc_automute_amp_unsol_event(codec, res); |
| 9271 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9272 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9273 | } |
| 9274 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9275 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9276 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9277 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9278 | struct alc_spec *spec = codec->spec; |
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 | spec->autocfg.hp_pins[0] = 0x14; |
| 9281 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9282 | } |
| 9283 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9284 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9285 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9286 | struct alc_spec *spec = codec->spec; |
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 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9289 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9290 | } |
| 9291 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9292 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9293 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9294 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9295 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9296 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9297 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9298 | } |
| 9299 | |
| 9300 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9301 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9302 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9303 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9304 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9305 | HDA_AMP_MUTE, bits); |
| 9306 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9307 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9308 | } |
| 9309 | |
| 9310 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9311 | unsigned int res) |
| 9312 | { |
| 9313 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9314 | alc883_lenovo_101e_all_automute(codec); |
| 9315 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9316 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9317 | } |
| 9318 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9319 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9320 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9321 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9322 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9323 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9324 | spec->autocfg.hp_pins[0] = 0x14; |
| 9325 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9326 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9327 | } |
| 9328 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9329 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9330 | /* HP Pin: output 0 (0x0c) */ |
| 9331 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9332 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9333 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9334 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9335 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9336 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9337 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9338 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9339 | /* eanable EAPD on medion laptop */ |
| 9340 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9341 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9342 | /* enable unsolicited event */ |
| 9343 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9344 | { } |
| 9345 | }; |
| 9346 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9347 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 9348 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9349 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9350 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9351 | { } /* end */ |
| 9352 | }; |
| 9353 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9354 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9355 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9356 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9357 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9358 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9359 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9360 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9361 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9362 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9363 | } |
| 9364 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9365 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9366 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9367 | struct alc_spec *spec = codec->spec; |
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 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9370 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9371 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9372 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9373 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9374 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9375 | } |
| 9376 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9377 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9378 | { |
| 9379 | struct alc_spec *spec = codec->spec; |
| 9380 | |
| 9381 | spec->autocfg.hp_pins[0] = 0x15; |
| 9382 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9383 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9384 | } |
| 9385 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9386 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9387 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9388 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9389 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9390 | /* enable unsolicited event */ |
| 9391 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9392 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9393 | { } /* end */ |
| 9394 | }; |
| 9395 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9396 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9397 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9398 | struct alc_spec *spec = codec->spec; |
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 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9401 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9402 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9403 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9404 | spec->ext_mic.pin = 0x18; |
| 9405 | spec->int_mic.pin = 0x19; |
| 9406 | spec->ext_mic.mux_idx = 0; |
| 9407 | spec->int_mic.mux_idx = 1; |
| 9408 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9409 | } |
| 9410 | |
| 9411 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9412 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9413 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9414 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9415 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9416 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9417 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9418 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9419 | /* enable unsolicited event */ |
| 9420 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9421 | { } /* end */ |
| 9422 | }; |
| 9423 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9424 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9425 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9426 | struct alc_spec *spec = codec->spec; |
| 9427 | |
| 9428 | spec->autocfg.hp_pins[0] = 0x14; |
| 9429 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9430 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9431 | } |
| 9432 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9433 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9434 | /* Init rear pin (used as headphone output) */ |
| 9435 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9436 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9437 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9438 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9439 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9440 | /* Init line 2 pin (used as headphone out by default) */ |
| 9441 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9442 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9443 | { } /* end */ |
| 9444 | }; |
| 9445 | |
| 9446 | /* Mute speakers according to the headphone jack state */ |
| 9447 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9448 | { |
| 9449 | unsigned int present; |
| 9450 | |
| 9451 | /* Mute only in 2ch or 4ch mode */ |
| 9452 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9453 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9454 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9455 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9456 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9457 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9458 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9459 | } |
| 9460 | } |
| 9461 | |
| 9462 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9463 | { |
| 9464 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9465 | alc889A_mb31_automute(codec); |
| 9466 | } |
| 9467 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9468 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9469 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9470 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9471 | #endif |
| 9472 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9473 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9474 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9475 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9476 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9477 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9478 | |
| 9479 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9480 | ALC1200_DIGOUT_NID, 0, |
| 9481 | }; |
| 9482 | |
| 9483 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9484 | ALC883_DIGOUT_NID, 0, |
| 9485 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9486 | |
| 9487 | /* |
| 9488 | * configuration and preset |
| 9489 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9490 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 9491 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9492 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9493 | [ALC882_ARIMA] = "arima", |
| 9494 | [ALC882_W2JC] = "w2jc", |
| 9495 | [ALC882_TARGA] = "targa", |
| 9496 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9497 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9498 | [ALC885_MACPRO] = "macpro", |
| 9499 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9500 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9501 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9502 | [ALC885_MBP3] = "mbp3", |
| 9503 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9504 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9505 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9506 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9507 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9508 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9509 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9510 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9511 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9512 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9513 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9514 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9515 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9516 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9517 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9518 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9519 | [ALC883_MEDION_MD2] = "medion-md2", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9520 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9521 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9522 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9523 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9524 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9525 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9526 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9527 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9528 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9529 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9530 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9531 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9532 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9533 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9534 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9535 | [ALC889A_INTEL] = "intel-alc889a", |
| 9536 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9537 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9538 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9539 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9540 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9541 | }; |
| 9542 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9543 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9544 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9545 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9546 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9547 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9548 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9549 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9550 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9551 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9552 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9553 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9554 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9555 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9556 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9557 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9558 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9559 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9560 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9561 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9562 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9563 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9564 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9565 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9566 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9567 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9568 | /* default Acer -- disabled as it causes more problems. |
| 9569 | * model=auto should work fine now |
| 9570 | */ |
| 9571 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9572 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9573 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9574 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9575 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9576 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9577 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9578 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9579 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9580 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9581 | |
| 9582 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9583 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9584 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9585 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9586 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9587 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9588 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9589 | 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] | 9590 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9591 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9592 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9593 | |
| 9594 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9595 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9596 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9597 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9598 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9599 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9600 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9601 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9602 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9603 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9604 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9605 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9606 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9607 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9608 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9609 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9610 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9611 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9612 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9613 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9614 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9615 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9616 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9617 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9618 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9619 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9620 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9621 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9622 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9623 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9624 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9625 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9626 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9627 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9628 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9629 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9630 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9631 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9632 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9633 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9634 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9635 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9636 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9637 | 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] | 9638 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9639 | 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] | 9640 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9641 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9642 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9643 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9644 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9645 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9646 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9647 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9648 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9649 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9650 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9651 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9652 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9653 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9654 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9655 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9656 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9657 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9658 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9659 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9660 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9661 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9662 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9663 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9664 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9665 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9666 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9667 | {} |
| 9668 | }; |
| 9669 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9670 | /* codec SSID table for Intel Mac */ |
| 9671 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9672 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9673 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9674 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9675 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9676 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9677 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9678 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 9679 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 9680 | 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] | 9681 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 9682 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9683 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9684 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9685 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9686 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9687 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 9688 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9689 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9690 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9691 | */ |
| 9692 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9693 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9694 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9695 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9696 | }; |
| 9697 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9698 | static struct alc_config_preset alc882_presets[] = { |
| 9699 | [ALC882_3ST_DIG] = { |
| 9700 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9701 | .init_verbs = { alc882_base_init_verbs, |
| 9702 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9703 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9704 | .dac_nids = alc882_dac_nids, |
| 9705 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9706 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9707 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9708 | .channel_mode = alc882_ch_modes, |
| 9709 | .need_dac_fix = 1, |
| 9710 | .input_mux = &alc882_capture_source, |
| 9711 | }, |
| 9712 | [ALC882_6ST_DIG] = { |
| 9713 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9714 | .init_verbs = { alc882_base_init_verbs, |
| 9715 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9716 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9717 | .dac_nids = alc882_dac_nids, |
| 9718 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9719 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9720 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9721 | .channel_mode = alc882_sixstack_modes, |
| 9722 | .input_mux = &alc882_capture_source, |
| 9723 | }, |
| 9724 | [ALC882_ARIMA] = { |
| 9725 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9726 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9727 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9728 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9729 | .dac_nids = alc882_dac_nids, |
| 9730 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9731 | .channel_mode = alc882_sixstack_modes, |
| 9732 | .input_mux = &alc882_capture_source, |
| 9733 | }, |
| 9734 | [ALC882_W2JC] = { |
| 9735 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9736 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9737 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9738 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9739 | .dac_nids = alc882_dac_nids, |
| 9740 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9741 | .channel_mode = alc880_threestack_modes, |
| 9742 | .need_dac_fix = 1, |
| 9743 | .input_mux = &alc882_capture_source, |
| 9744 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9745 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9746 | [ALC885_MBA21] = { |
| 9747 | .mixers = { alc885_mba21_mixer }, |
| 9748 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 9749 | .num_dacs = 2, |
| 9750 | .dac_nids = alc882_dac_nids, |
| 9751 | .channel_mode = alc885_mba21_ch_modes, |
| 9752 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9753 | .input_mux = &alc882_capture_source, |
| 9754 | .unsol_event = alc_automute_amp_unsol_event, |
| 9755 | .setup = alc885_mba21_setup, |
| 9756 | .init_hook = alc_automute_amp, |
| 9757 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9758 | [ALC885_MBP3] = { |
| 9759 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 9760 | .init_verbs = { alc885_mbp3_init_verbs, |
| 9761 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9762 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9763 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9764 | .hp_nid = 0x04, |
| 9765 | .channel_mode = alc885_mbp_4ch_modes, |
| 9766 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9767 | .input_mux = &alc882_capture_source, |
| 9768 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9769 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9770 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9771 | .setup = alc885_mbp3_setup, |
| 9772 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9773 | }, |
| 9774 | [ALC885_MB5] = { |
| 9775 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 9776 | .init_verbs = { alc885_mb5_init_verbs, |
| 9777 | alc880_gpio1_init_verbs }, |
| 9778 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9779 | .dac_nids = alc882_dac_nids, |
| 9780 | .channel_mode = alc885_mb5_6ch_modes, |
| 9781 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 9782 | .input_mux = &mb5_capture_source, |
| 9783 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9784 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9785 | .unsol_event = alc_automute_amp_unsol_event, |
| 9786 | .setup = alc885_mb5_setup, |
| 9787 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9788 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9789 | [ALC885_MACMINI3] = { |
| 9790 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 9791 | .init_verbs = { alc885_macmini3_init_verbs, |
| 9792 | alc880_gpio1_init_verbs }, |
| 9793 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9794 | .dac_nids = alc882_dac_nids, |
| 9795 | .channel_mode = alc885_macmini3_6ch_modes, |
| 9796 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 9797 | .input_mux = &macmini3_capture_source, |
| 9798 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9799 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9800 | .unsol_event = alc_automute_amp_unsol_event, |
| 9801 | .setup = alc885_macmini3_setup, |
| 9802 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9803 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9804 | [ALC885_MACPRO] = { |
| 9805 | .mixers = { alc882_macpro_mixer }, |
| 9806 | .init_verbs = { alc882_macpro_init_verbs }, |
| 9807 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9808 | .dac_nids = alc882_dac_nids, |
| 9809 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9810 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9811 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9812 | .channel_mode = alc882_ch_modes, |
| 9813 | .input_mux = &alc882_capture_source, |
| 9814 | .init_hook = alc885_macpro_init_hook, |
| 9815 | }, |
| 9816 | [ALC885_IMAC24] = { |
| 9817 | .mixers = { alc885_imac24_mixer }, |
| 9818 | .init_verbs = { alc885_imac24_init_verbs }, |
| 9819 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9820 | .dac_nids = alc882_dac_nids, |
| 9821 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9822 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9823 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9824 | .channel_mode = alc882_ch_modes, |
| 9825 | .input_mux = &alc882_capture_source, |
| 9826 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9827 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9828 | .init_hook = alc885_imac24_init_hook, |
| 9829 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9830 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 9831 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9832 | .init_verbs = { alc885_imac91_init_verbs, |
| 9833 | alc880_gpio1_init_verbs }, |
| 9834 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9835 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 9836 | .channel_mode = alc885_mba21_ch_modes, |
| 9837 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9838 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9839 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9840 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9841 | .unsol_event = alc_automute_amp_unsol_event, |
| 9842 | .setup = alc885_imac91_setup, |
| 9843 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9844 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9845 | [ALC882_TARGA] = { |
| 9846 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9847 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 9848 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9849 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9850 | .dac_nids = alc882_dac_nids, |
| 9851 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9852 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9853 | .adc_nids = alc882_adc_nids, |
| 9854 | .capsrc_nids = alc882_capsrc_nids, |
| 9855 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9856 | .channel_mode = alc882_3ST_6ch_modes, |
| 9857 | .need_dac_fix = 1, |
| 9858 | .input_mux = &alc882_capture_source, |
| 9859 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9860 | .setup = alc882_targa_setup, |
| 9861 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9862 | }, |
| 9863 | [ALC882_ASUS_A7J] = { |
| 9864 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9865 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9866 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9867 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9868 | .dac_nids = alc882_dac_nids, |
| 9869 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9870 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9871 | .adc_nids = alc882_adc_nids, |
| 9872 | .capsrc_nids = alc882_capsrc_nids, |
| 9873 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9874 | .channel_mode = alc882_3ST_6ch_modes, |
| 9875 | .need_dac_fix = 1, |
| 9876 | .input_mux = &alc882_capture_source, |
| 9877 | }, |
| 9878 | [ALC882_ASUS_A7M] = { |
| 9879 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9880 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9881 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9882 | alc882_asus_a7m_verbs }, |
| 9883 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9884 | .dac_nids = alc882_dac_nids, |
| 9885 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9886 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9887 | .channel_mode = alc880_threestack_modes, |
| 9888 | .need_dac_fix = 1, |
| 9889 | .input_mux = &alc882_capture_source, |
| 9890 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9891 | [ALC883_3ST_2ch_DIG] = { |
| 9892 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9893 | .init_verbs = { alc883_init_verbs }, |
| 9894 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9895 | .dac_nids = alc883_dac_nids, |
| 9896 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9897 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9898 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9899 | .channel_mode = alc883_3ST_2ch_modes, |
| 9900 | .input_mux = &alc883_capture_source, |
| 9901 | }, |
| 9902 | [ALC883_3ST_6ch_DIG] = { |
| 9903 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9904 | .init_verbs = { alc883_init_verbs }, |
| 9905 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9906 | .dac_nids = alc883_dac_nids, |
| 9907 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9908 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9909 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9910 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9911 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9912 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9913 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9914 | [ALC883_3ST_6ch] = { |
| 9915 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9916 | .init_verbs = { alc883_init_verbs }, |
| 9917 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9918 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9919 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9920 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9921 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9922 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9923 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9924 | [ALC883_3ST_6ch_INTEL] = { |
| 9925 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9926 | .init_verbs = { alc883_init_verbs }, |
| 9927 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9928 | .dac_nids = alc883_dac_nids, |
| 9929 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9930 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9931 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9932 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9933 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9934 | .need_dac_fix = 1, |
| 9935 | .input_mux = &alc883_3stack_6ch_intel, |
| 9936 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9937 | [ALC889A_INTEL] = { |
| 9938 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9939 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 9940 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9941 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9942 | .dac_nids = alc883_dac_nids, |
| 9943 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9944 | .adc_nids = alc889_adc_nids, |
| 9945 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9946 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9947 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9948 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9949 | .channel_mode = alc889_8ch_intel_modes, |
| 9950 | .capsrc_nids = alc889_capsrc_nids, |
| 9951 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9952 | .setup = alc889_automute_setup, |
| 9953 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9954 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9955 | .need_dac_fix = 1, |
| 9956 | }, |
| 9957 | [ALC889_INTEL] = { |
| 9958 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9959 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9960 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9961 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9962 | .dac_nids = alc883_dac_nids, |
| 9963 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9964 | .adc_nids = alc889_adc_nids, |
| 9965 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9966 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9967 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9968 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9969 | .channel_mode = alc889_8ch_intel_modes, |
| 9970 | .capsrc_nids = alc889_capsrc_nids, |
| 9971 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9972 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9973 | .init_hook = alc889_intel_init_hook, |
| 9974 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9975 | .need_dac_fix = 1, |
| 9976 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9977 | [ALC883_6ST_DIG] = { |
| 9978 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9979 | .init_verbs = { alc883_init_verbs }, |
| 9980 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9981 | .dac_nids = alc883_dac_nids, |
| 9982 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9983 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9984 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9985 | .channel_mode = alc883_sixstack_modes, |
| 9986 | .input_mux = &alc883_capture_source, |
| 9987 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9988 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9989 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9990 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9991 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9992 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9993 | .dac_nids = alc883_dac_nids, |
| 9994 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9995 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9996 | .channel_mode = alc883_3ST_6ch_modes, |
| 9997 | .need_dac_fix = 1, |
| 9998 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9999 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10000 | .setup = alc882_targa_setup, |
| 10001 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10002 | }, |
| 10003 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10004 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10005 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10006 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10007 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10008 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10009 | .adc_nids = alc883_adc_nids_alt, |
| 10010 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10011 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10012 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10013 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10014 | .channel_mode = alc883_3ST_2ch_modes, |
| 10015 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10016 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10017 | .setup = alc882_targa_setup, |
| 10018 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10019 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10020 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10021 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10022 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10023 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10024 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10025 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10026 | .dac_nids = alc883_dac_nids, |
| 10027 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10028 | .adc_nids = alc883_adc_nids_rev, |
| 10029 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10030 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10031 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10032 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10033 | .channel_mode = alc883_4ST_8ch_modes, |
| 10034 | .need_dac_fix = 1, |
| 10035 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10036 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10037 | .setup = alc882_targa_setup, |
| 10038 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10039 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10040 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10041 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10042 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10043 | * and the headphone jack. Turn this on and rely on the |
| 10044 | * standard mute methods whenever the user wants to turn |
| 10045 | * these outputs off. |
| 10046 | */ |
| 10047 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10048 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10049 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10050 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10051 | .channel_mode = alc883_3ST_2ch_modes, |
| 10052 | .input_mux = &alc883_capture_source, |
| 10053 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10054 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10055 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10056 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10057 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10058 | .dac_nids = alc883_dac_nids, |
| 10059 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10060 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10061 | .channel_mode = alc883_3ST_2ch_modes, |
| 10062 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10063 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10064 | .setup = alc883_acer_aspire_setup, |
| 10065 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10066 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10067 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10068 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10069 | alc883_chmode_mixer }, |
| 10070 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10071 | alc888_acer_aspire_4930g_verbs }, |
| 10072 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10073 | .dac_nids = alc883_dac_nids, |
| 10074 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10075 | .adc_nids = alc883_adc_nids_rev, |
| 10076 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10077 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10078 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10079 | .channel_mode = alc883_3ST_6ch_modes, |
| 10080 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10081 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10082 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10083 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10084 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10085 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10086 | .setup = alc888_acer_aspire_4930g_setup, |
| 10087 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10088 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10089 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10090 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10091 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10092 | alc888_acer_aspire_6530g_verbs }, |
| 10093 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10094 | .dac_nids = alc883_dac_nids, |
| 10095 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10096 | .adc_nids = alc883_adc_nids_rev, |
| 10097 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10098 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10099 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10100 | .channel_mode = alc883_3ST_2ch_modes, |
| 10101 | .num_mux_defs = |
| 10102 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10103 | .input_mux = alc888_acer_aspire_6530_sources, |
| 10104 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10105 | .setup = alc888_acer_aspire_6530g_setup, |
| 10106 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10107 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10108 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10109 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10110 | alc883_chmode_mixer }, |
| 10111 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10112 | alc889_acer_aspire_8930g_verbs, |
| 10113 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10114 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10115 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10116 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10117 | .adc_nids = alc889_adc_nids, |
| 10118 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10119 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10120 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10121 | .channel_mode = alc883_3ST_6ch_modes, |
| 10122 | .need_dac_fix = 1, |
| 10123 | .const_channel_count = 6, |
| 10124 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10125 | ARRAY_SIZE(alc889_capture_sources), |
| 10126 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10127 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10128 | .setup = alc889_acer_aspire_8930g_setup, |
| 10129 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10130 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10131 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10132 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10133 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10134 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10135 | .mixers = { alc883_3ST_6ch_mixer, |
| 10136 | alc883_chmode_mixer }, |
| 10137 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10138 | alc888_acer_aspire_7730G_verbs }, |
| 10139 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10140 | .dac_nids = alc883_dac_nids, |
| 10141 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10142 | .adc_nids = alc883_adc_nids_rev, |
| 10143 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10144 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10145 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10146 | .channel_mode = alc883_3ST_6ch_modes, |
| 10147 | .need_dac_fix = 1, |
| 10148 | .const_channel_count = 6, |
| 10149 | .input_mux = &alc883_capture_source, |
| 10150 | .unsol_event = alc_automute_amp_unsol_event, |
| 10151 | .setup = alc888_acer_aspire_6530g_setup, |
| 10152 | .init_hook = alc_automute_amp, |
| 10153 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10154 | [ALC883_MEDION] = { |
| 10155 | .mixers = { alc883_fivestack_mixer, |
| 10156 | alc883_chmode_mixer }, |
| 10157 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10158 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10159 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10160 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10161 | .adc_nids = alc883_adc_nids_alt, |
| 10162 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10163 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10164 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10165 | .channel_mode = alc883_sixstack_modes, |
| 10166 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10167 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10168 | [ALC883_MEDION_MD2] = { |
| 10169 | .mixers = { alc883_medion_md2_mixer}, |
| 10170 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 10171 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10172 | .dac_nids = alc883_dac_nids, |
| 10173 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10174 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10175 | .channel_mode = alc883_3ST_2ch_modes, |
| 10176 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10177 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10178 | .setup = alc883_medion_md2_setup, |
| 10179 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10180 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10181 | [ALC883_MEDION_WIM2160] = { |
| 10182 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10183 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10184 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10185 | .dac_nids = alc883_dac_nids, |
| 10186 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10187 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10188 | .adc_nids = alc883_adc_nids, |
| 10189 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10190 | .channel_mode = alc883_3ST_2ch_modes, |
| 10191 | .input_mux = &alc883_capture_source, |
| 10192 | .unsol_event = alc_automute_amp_unsol_event, |
| 10193 | .setup = alc883_medion_wim2160_setup, |
| 10194 | .init_hook = alc_automute_amp, |
| 10195 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10196 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10197 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10198 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10199 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10200 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10201 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10202 | .channel_mode = alc883_3ST_2ch_modes, |
| 10203 | .input_mux = &alc883_capture_source, |
| 10204 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10205 | [ALC883_CLEVO_M540R] = { |
| 10206 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10207 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10208 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10209 | .dac_nids = alc883_dac_nids, |
| 10210 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10211 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10212 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10213 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10214 | .need_dac_fix = 1, |
| 10215 | .input_mux = &alc883_capture_source, |
| 10216 | /* This machine has the hardware HP auto-muting, thus |
| 10217 | * we need no software mute via unsol event |
| 10218 | */ |
| 10219 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10220 | [ALC883_CLEVO_M720] = { |
| 10221 | .mixers = { alc883_clevo_m720_mixer }, |
| 10222 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10223 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10224 | .dac_nids = alc883_dac_nids, |
| 10225 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10226 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10227 | .channel_mode = alc883_3ST_2ch_modes, |
| 10228 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10229 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10230 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10231 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10232 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10233 | [ALC883_LENOVO_101E_2ch] = { |
| 10234 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10235 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10236 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10237 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10238 | .adc_nids = alc883_adc_nids_alt, |
| 10239 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10240 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10241 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10242 | .channel_mode = alc883_3ST_2ch_modes, |
| 10243 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 10244 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 10245 | .init_hook = alc883_lenovo_101e_all_automute, |
| 10246 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10247 | [ALC883_LENOVO_NB0763] = { |
| 10248 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10249 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10250 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10251 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10252 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10253 | .channel_mode = alc883_3ST_2ch_modes, |
| 10254 | .need_dac_fix = 1, |
| 10255 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10256 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10257 | .setup = alc883_medion_md2_setup, |
| 10258 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10259 | }, |
| 10260 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10261 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10262 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10263 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10264 | .dac_nids = alc883_dac_nids, |
| 10265 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10266 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10267 | .channel_mode = alc883_3ST_6ch_modes, |
| 10268 | .need_dac_fix = 1, |
| 10269 | .input_mux = &alc883_capture_source, |
| 10270 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 10271 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10272 | }, |
| 10273 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10274 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10275 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10276 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10277 | .dac_nids = alc883_dac_nids, |
| 10278 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10279 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10280 | .channel_mode = alc883_3ST_2ch_modes, |
| 10281 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10282 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10283 | .setup = alc883_haier_w66_setup, |
| 10284 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10285 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10286 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10287 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10288 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10289 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10290 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10291 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10292 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10293 | .need_dac_fix = 1, |
| 10294 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10295 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10296 | .setup = alc888_3st_hp_setup, |
| 10297 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10298 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10299 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10300 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10301 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10302 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10303 | .dac_nids = alc883_dac_nids, |
| 10304 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10305 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10306 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10307 | .channel_mode = alc883_sixstack_modes, |
| 10308 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10309 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10310 | .setup = alc888_6st_dell_setup, |
| 10311 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10312 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10313 | [ALC883_MITAC] = { |
| 10314 | .mixers = { alc883_mitac_mixer }, |
| 10315 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10316 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10317 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10318 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10319 | .channel_mode = alc883_3ST_2ch_modes, |
| 10320 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10321 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10322 | .setup = alc883_mitac_setup, |
| 10323 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10324 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10325 | [ALC883_FUJITSU_PI2515] = { |
| 10326 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10327 | .init_verbs = { alc883_init_verbs, |
| 10328 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10329 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10330 | .dac_nids = alc883_dac_nids, |
| 10331 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10332 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10333 | .channel_mode = alc883_3ST_2ch_modes, |
| 10334 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10335 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10336 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10337 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10338 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10339 | [ALC888_FUJITSU_XA3530] = { |
| 10340 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10341 | .init_verbs = { alc883_init_verbs, |
| 10342 | alc888_fujitsu_xa3530_verbs }, |
| 10343 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10344 | .dac_nids = alc883_dac_nids, |
| 10345 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10346 | .adc_nids = alc883_adc_nids_rev, |
| 10347 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10348 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10349 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10350 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10351 | .num_mux_defs = |
| 10352 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10353 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10354 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10355 | .setup = alc888_fujitsu_xa3530_setup, |
| 10356 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10357 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10358 | [ALC888_LENOVO_SKY] = { |
| 10359 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10360 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10361 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10362 | .dac_nids = alc883_dac_nids, |
| 10363 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10364 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10365 | .channel_mode = alc883_sixstack_modes, |
| 10366 | .need_dac_fix = 1, |
| 10367 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10368 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10369 | .setup = alc888_lenovo_sky_setup, |
| 10370 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10371 | }, |
| 10372 | [ALC888_ASUS_M90V] = { |
| 10373 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10374 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10375 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10376 | .dac_nids = alc883_dac_nids, |
| 10377 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10378 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10379 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10380 | .channel_mode = alc883_3ST_6ch_modes, |
| 10381 | .need_dac_fix = 1, |
| 10382 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10383 | .unsol_event = alc_sku_unsol_event, |
| 10384 | .setup = alc883_mode2_setup, |
| 10385 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10386 | }, |
| 10387 | [ALC888_ASUS_EEE1601] = { |
| 10388 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10389 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10390 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10391 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10392 | .dac_nids = alc883_dac_nids, |
| 10393 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10394 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10395 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10396 | .channel_mode = alc883_3ST_2ch_modes, |
| 10397 | .need_dac_fix = 1, |
| 10398 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10399 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10400 | .init_hook = alc883_eee1601_inithook, |
| 10401 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10402 | [ALC1200_ASUS_P5Q] = { |
| 10403 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10404 | .init_verbs = { alc883_init_verbs }, |
| 10405 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10406 | .dac_nids = alc883_dac_nids, |
| 10407 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10408 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10409 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10410 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10411 | .channel_mode = alc883_sixstack_modes, |
| 10412 | .input_mux = &alc883_capture_source, |
| 10413 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10414 | [ALC889A_MB31] = { |
| 10415 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10416 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10417 | alc880_gpio1_init_verbs }, |
| 10418 | .adc_nids = alc883_adc_nids, |
| 10419 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10420 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10421 | .dac_nids = alc883_dac_nids, |
| 10422 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10423 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10424 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10425 | .input_mux = &alc889A_mb31_capture_source, |
| 10426 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10427 | .unsol_event = alc889A_mb31_unsol_event, |
| 10428 | .init_hook = alc889A_mb31_automute, |
| 10429 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10430 | [ALC883_SONY_VAIO_TT] = { |
| 10431 | .mixers = { alc883_vaiott_mixer }, |
| 10432 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10433 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10434 | .dac_nids = alc883_dac_nids, |
| 10435 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10436 | .channel_mode = alc883_3ST_2ch_modes, |
| 10437 | .input_mux = &alc883_capture_source, |
| 10438 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10439 | .setup = alc883_vaiott_setup, |
| 10440 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10441 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10442 | }; |
| 10443 | |
| 10444 | |
| 10445 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10446 | * Pin config fixes |
| 10447 | */ |
| 10448 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10449 | PINFIX_ABIT_AW9D_MAX, |
| 10450 | PINFIX_PB_M5210, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10451 | }; |
| 10452 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10453 | static const struct alc_fixup alc882_fixups[] = { |
| 10454 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame^] | 10455 | .pins = (const struct alc_pincfg[]) { |
| 10456 | { 0x15, 0x01080104 }, /* side */ |
| 10457 | { 0x16, 0x01011012 }, /* rear */ |
| 10458 | { 0x17, 0x01016011 }, /* clfe */ |
| 10459 | { } |
| 10460 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10461 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10462 | [PINFIX_PB_M5210] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame^] | 10463 | .verbs = (const struct hda_verb[]) { |
| 10464 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10465 | {} |
| 10466 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10467 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10468 | }; |
| 10469 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10470 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10471 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10472 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 10473 | {} |
| 10474 | }; |
| 10475 | |
| 10476 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10477 | * BIOS auto configuration |
| 10478 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10479 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10480 | const struct auto_pin_cfg *cfg) |
| 10481 | { |
| 10482 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10483 | } |
| 10484 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10485 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10486 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10487 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10488 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10489 | int idx; |
| 10490 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10491 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10492 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10493 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10494 | if (dac == 0x25) |
| 10495 | idx = 4; |
| 10496 | else if (dac >= 0x02 && dac <= 0x05) |
| 10497 | idx = dac - 2; |
| 10498 | else |
| 10499 | return; |
| 10500 | 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] | 10501 | } |
| 10502 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10503 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10504 | { |
| 10505 | struct alc_spec *spec = codec->spec; |
| 10506 | int i; |
| 10507 | |
| 10508 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10509 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10510 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10511 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10512 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10513 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10514 | } |
| 10515 | } |
| 10516 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10517 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10518 | { |
| 10519 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10520 | hda_nid_t pin, dac; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10521 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10522 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10523 | if (pin) { |
| 10524 | dac = spec->multiout.hp_nid; |
| 10525 | if (!dac) |
| 10526 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10527 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10528 | } |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10529 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10530 | if (pin) { |
| 10531 | dac = spec->multiout.extra_out_nid[0]; |
| 10532 | if (!dac) |
| 10533 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10534 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10535 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10536 | } |
| 10537 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10538 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10539 | { |
| 10540 | struct alc_spec *spec = codec->spec; |
| 10541 | int i; |
| 10542 | |
| 10543 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10544 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10545 | if (!nid) |
| 10546 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 10547 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10548 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10549 | snd_hda_codec_write(codec, nid, 0, |
| 10550 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10551 | AMP_OUT_MUTE); |
| 10552 | } |
| 10553 | } |
| 10554 | |
| 10555 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10556 | { |
| 10557 | struct alc_spec *spec = codec->spec; |
| 10558 | int c; |
| 10559 | |
| 10560 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10561 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10562 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10563 | unsigned int mux_idx; |
| 10564 | const struct hda_input_mux *imux; |
| 10565 | int conns, mute, idx, item; |
| 10566 | |
| 10567 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10568 | ARRAY_SIZE(conn_list)); |
| 10569 | if (conns < 0) |
| 10570 | continue; |
| 10571 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10572 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10573 | if (!imux->num_items && mux_idx > 0) |
| 10574 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10575 | for (idx = 0; idx < conns; idx++) { |
| 10576 | /* if the current connection is the selected one, |
| 10577 | * unmute it as default - otherwise mute it |
| 10578 | */ |
| 10579 | mute = AMP_IN_MUTE(idx); |
| 10580 | for (item = 0; item < imux->num_items; item++) { |
| 10581 | if (imux->items[item].index == idx) { |
| 10582 | if (spec->cur_mux[c] == item) |
| 10583 | mute = AMP_IN_UNMUTE(idx); |
| 10584 | break; |
| 10585 | } |
| 10586 | } |
| 10587 | /* check if we have a selector or mixer |
| 10588 | * we could check for the widget type instead, but |
| 10589 | * just check for Amp-In presence (in case of mixer |
| 10590 | * without amp-in there is something wrong, this |
| 10591 | * function shouldn't be used or capsrc nid is wrong) |
| 10592 | */ |
| 10593 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10594 | snd_hda_codec_write(codec, nid, 0, |
| 10595 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10596 | mute); |
| 10597 | else if (mute != AMP_IN_MUTE(idx)) |
| 10598 | snd_hda_codec_write(codec, nid, 0, |
| 10599 | AC_VERB_SET_CONNECT_SEL, |
| 10600 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10601 | } |
| 10602 | } |
| 10603 | } |
| 10604 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10605 | /* add mic boosts if needed */ |
| 10606 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10607 | { |
| 10608 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10609 | int err; |
| 10610 | hda_nid_t nid; |
| 10611 | |
| 10612 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 10613 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10614 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10615 | "Mic Boost", |
| 10616 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10617 | if (err < 0) |
| 10618 | return err; |
| 10619 | } |
| 10620 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 10621 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10622 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10623 | "Front Mic Boost", |
| 10624 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10625 | if (err < 0) |
| 10626 | return err; |
| 10627 | } |
| 10628 | return 0; |
| 10629 | } |
| 10630 | |
| 10631 | /* almost identical with ALC880 parser... */ |
| 10632 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10633 | { |
| 10634 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10635 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10636 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10637 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10638 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10639 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10640 | if (err < 0) |
| 10641 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10642 | if (!spec->autocfg.line_outs) |
| 10643 | return 0; /* can't find valid BIOS pin config */ |
| 10644 | |
| 10645 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10646 | if (err < 0) |
| 10647 | return err; |
| 10648 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10649 | if (err < 0) |
| 10650 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10651 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10652 | "Headphone"); |
| 10653 | if (err < 0) |
| 10654 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10655 | err = alc880_auto_create_extra_out(spec, |
| 10656 | spec->autocfg.speaker_pins[0], |
| 10657 | "Speaker"); |
| 10658 | if (err < 0) |
| 10659 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10660 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10661 | if (err < 0) |
| 10662 | return err; |
| 10663 | |
| 10664 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10665 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10666 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10667 | |
| 10668 | if (spec->kctls.list) |
| 10669 | add_mixer(spec, spec->kctls.list); |
| 10670 | |
| 10671 | add_verb(spec, alc883_auto_init_verbs); |
| 10672 | /* if ADC 0x07 is available, initialize it, too */ |
| 10673 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10674 | add_verb(spec, alc882_adc1_init_verbs); |
| 10675 | |
| 10676 | spec->num_mux_defs = 1; |
| 10677 | spec->input_mux = &spec->private_imux[0]; |
| 10678 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10679 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10680 | |
| 10681 | err = alc_auto_add_mic_boost(codec); |
| 10682 | if (err < 0) |
| 10683 | return err; |
| 10684 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10685 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10686 | } |
| 10687 | |
| 10688 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10689 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10690 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10691 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10692 | alc882_auto_init_multi_out(codec); |
| 10693 | alc882_auto_init_hp_out(codec); |
| 10694 | alc882_auto_init_analog_input(codec); |
| 10695 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 10696 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10697 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10698 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10699 | } |
| 10700 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10701 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10702 | { |
| 10703 | struct alc_spec *spec; |
| 10704 | int err, board_config; |
| 10705 | |
| 10706 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10707 | if (spec == NULL) |
| 10708 | return -ENOMEM; |
| 10709 | |
| 10710 | codec->spec = spec; |
| 10711 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10712 | alc_auto_parse_customize_define(codec); |
| 10713 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10714 | switch (codec->vendor_id) { |
| 10715 | case 0x10ec0882: |
| 10716 | case 0x10ec0885: |
| 10717 | break; |
| 10718 | default: |
| 10719 | /* ALC883 and variants */ |
| 10720 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10721 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10722 | } |
| 10723 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10724 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10725 | alc882_models, |
| 10726 | alc882_cfg_tbl); |
| 10727 | |
| 10728 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10729 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10730 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10731 | |
| 10732 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10733 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10734 | codec->chip_name); |
| 10735 | board_config = ALC882_AUTO; |
| 10736 | } |
| 10737 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10738 | if (board_config == ALC882_AUTO) |
| 10739 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10740 | |
| 10741 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10742 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10743 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10744 | if (err < 0) { |
| 10745 | alc_free(codec); |
| 10746 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10747 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10748 | printk(KERN_INFO |
| 10749 | "hda_codec: Cannot set up configuration " |
| 10750 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10751 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10752 | } |
| 10753 | } |
| 10754 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 10755 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 10756 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 10757 | if (err < 0) { |
| 10758 | alc_free(codec); |
| 10759 | return err; |
| 10760 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 10761 | } |
| 10762 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10763 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 10764 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10765 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10766 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 10767 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 10768 | /* FIXME: setup DAC5 */ |
| 10769 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 10770 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 10771 | |
| 10772 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 10773 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 10774 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10775 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10776 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10777 | spec->num_adc_nids = 0; |
| 10778 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10779 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10780 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10781 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10782 | hda_nid_t nid = alc882_adc_nids[i]; |
| 10783 | unsigned int wcap = get_wcaps(codec, nid); |
| 10784 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 10785 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10786 | if (wcap != AC_WID_AUD_IN) |
| 10787 | continue; |
| 10788 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 10789 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 10790 | if (err < 0) |
| 10791 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10792 | err = snd_hda_get_connections(codec, cap, items, |
| 10793 | ARRAY_SIZE(items)); |
| 10794 | if (err < 0) |
| 10795 | continue; |
| 10796 | for (j = 0; j < imux->num_items; j++) |
| 10797 | if (imux->items[j].index >= err) |
| 10798 | break; |
| 10799 | if (j < imux->num_items) |
| 10800 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10801 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 10802 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10803 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10804 | spec->adc_nids = spec->private_adc_nids; |
| 10805 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10806 | } |
| 10807 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 10808 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10809 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 10810 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10811 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10812 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10813 | if (board_config == ALC882_AUTO) |
| 10814 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); |
| 10815 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10816 | spec->vmaster_nid = 0x0c; |
| 10817 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10818 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10819 | if (board_config == ALC882_AUTO) |
| 10820 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10821 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10822 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10823 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10824 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10825 | |
| 10826 | return 0; |
| 10827 | } |
| 10828 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10829 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10830 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10831 | * ALC262 support |
| 10832 | */ |
| 10833 | |
| 10834 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 10835 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 10836 | |
| 10837 | #define alc262_dac_nids alc260_dac_nids |
| 10838 | #define alc262_adc_nids alc882_adc_nids |
| 10839 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10840 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 10841 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10842 | |
| 10843 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 10844 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10845 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10846 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 10847 | /* ADC0 */ |
| 10848 | 0x09 |
| 10849 | }; |
| 10850 | |
| 10851 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 10852 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10853 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 10854 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10855 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10856 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10857 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10858 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10859 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10860 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10861 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10862 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10863 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10864 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10865 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10866 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 10867 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10868 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 10869 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10870 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10871 | }; |
| 10872 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10873 | /* update HP, line and mono-out pins according to the master switch */ |
| 10874 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 10875 | { |
| 10876 | struct alc_spec *spec = codec->spec; |
| 10877 | int val = spec->master_sw; |
| 10878 | |
| 10879 | /* HP & line-out */ |
| 10880 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 10881 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10882 | val ? PIN_HP : 0); |
| 10883 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10884 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10885 | val ? PIN_HP : 0); |
| 10886 | /* mono (speaker) depending on the HP jack sense */ |
| 10887 | val = val && !spec->jack_present; |
| 10888 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 10889 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10890 | val ? PIN_OUT : 0); |
| 10891 | } |
| 10892 | |
| 10893 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 10894 | { |
| 10895 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10896 | |
| 10897 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10898 | alc262_hp_master_update(codec); |
| 10899 | } |
| 10900 | |
| 10901 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10902 | { |
| 10903 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10904 | return; |
| 10905 | alc262_hp_bpc_automute(codec); |
| 10906 | } |
| 10907 | |
| 10908 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 10909 | { |
| 10910 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10911 | |
| 10912 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10913 | alc262_hp_master_update(codec); |
| 10914 | } |
| 10915 | |
| 10916 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 10917 | unsigned int res) |
| 10918 | { |
| 10919 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10920 | return; |
| 10921 | alc262_hp_wildwest_automute(codec); |
| 10922 | } |
| 10923 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10924 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10925 | |
| 10926 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10927 | struct snd_ctl_elem_value *ucontrol) |
| 10928 | { |
| 10929 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10930 | struct alc_spec *spec = codec->spec; |
| 10931 | int val = !!*ucontrol->value.integer.value; |
| 10932 | |
| 10933 | if (val == spec->master_sw) |
| 10934 | return 0; |
| 10935 | spec->master_sw = val; |
| 10936 | alc262_hp_master_update(codec); |
| 10937 | return 1; |
| 10938 | } |
| 10939 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10940 | #define ALC262_HP_MASTER_SWITCH \ |
| 10941 | { \ |
| 10942 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10943 | .name = "Master Playback Switch", \ |
| 10944 | .info = snd_ctl_boolean_mono_info, \ |
| 10945 | .get = alc262_hp_master_sw_get, \ |
| 10946 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10947 | }, \ |
| 10948 | { \ |
| 10949 | .iface = NID_MAPPING, \ |
| 10950 | .name = "Master Playback Switch", \ |
| 10951 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10952 | } |
| 10953 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10954 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10955 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10956 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10957 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10958 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10959 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10960 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10961 | HDA_OUTPUT), |
| 10962 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10963 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10964 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10965 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10966 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10967 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10968 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10969 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10970 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10971 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10972 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10973 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10974 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10975 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10976 | { } /* end */ |
| 10977 | }; |
| 10978 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10979 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10980 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10981 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10982 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10983 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10984 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10985 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10986 | HDA_OUTPUT), |
| 10987 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10988 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10989 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10990 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10991 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10992 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10993 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10994 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10995 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10996 | { } /* end */ |
| 10997 | }; |
| 10998 | |
| 10999 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 11000 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11001 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 11002 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11003 | { } /* end */ |
| 11004 | }; |
| 11005 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11006 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11007 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11008 | { |
| 11009 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11010 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11011 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11012 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11013 | } |
| 11014 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11015 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11016 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11017 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11018 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11019 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11020 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11021 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11022 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11023 | { } /* end */ |
| 11024 | }; |
| 11025 | |
| 11026 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 11027 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11028 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11029 | |
| 11030 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11031 | { } |
| 11032 | }; |
| 11033 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11034 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11035 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11036 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11037 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11038 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11039 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11040 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11041 | { } /* end */ |
| 11042 | }; |
| 11043 | |
| 11044 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 11045 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11046 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11047 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11048 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11049 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11050 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11051 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11052 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11053 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11054 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11055 | {} |
| 11056 | }; |
| 11057 | |
| 11058 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 11059 | .num_items = 1, |
| 11060 | .items = { |
| 11061 | { "Line", 0x1 }, |
| 11062 | }, |
| 11063 | }; |
| 11064 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11065 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 11066 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 11067 | { |
| 11068 | struct alc_spec *spec = codec->spec; |
| 11069 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11070 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11071 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11072 | unsigned int mute; |
| 11073 | |
| 11074 | /* HP */ |
| 11075 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 11076 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 11077 | HDA_AMP_MUTE, mute); |
| 11078 | /* mute internal speaker per jack sense */ |
| 11079 | if (spec->jack_present) |
| 11080 | mute = HDA_AMP_MUTE; |
| 11081 | if (line_nid) |
| 11082 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 11083 | HDA_AMP_MUTE, mute); |
| 11084 | if (speaker_nid && speaker_nid != line_nid) |
| 11085 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 11086 | HDA_AMP_MUTE, mute); |
| 11087 | } |
| 11088 | |
| 11089 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 11090 | |
| 11091 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11092 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11093 | { |
| 11094 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11095 | struct alc_spec *spec = codec->spec; |
| 11096 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11097 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11098 | if (val == spec->master_sw) |
| 11099 | return 0; |
| 11100 | spec->master_sw = val; |
| 11101 | alc262_hippo_master_update(codec); |
| 11102 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11103 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11104 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11105 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11106 | { \ |
| 11107 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11108 | .name = "Master Playback Switch", \ |
| 11109 | .info = snd_ctl_boolean_mono_info, \ |
| 11110 | .get = alc262_hippo_master_sw_get, \ |
| 11111 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11112 | }, \ |
| 11113 | { \ |
| 11114 | .iface = NID_MAPPING, \ |
| 11115 | .name = "Master Playback Switch", \ |
| 11116 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11117 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11118 | } |
| 11119 | |
| 11120 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11121 | ALC262_HIPPO_MASTER_SWITCH, |
| 11122 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11123 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11124 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11125 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11126 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11127 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11128 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11129 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11130 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11131 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11132 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11133 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11134 | { } /* end */ |
| 11135 | }; |
| 11136 | |
| 11137 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11138 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11139 | ALC262_HIPPO_MASTER_SWITCH, |
| 11140 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11141 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11142 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11143 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11144 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11145 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11146 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11147 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11148 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11149 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11150 | { } /* end */ |
| 11151 | }; |
| 11152 | |
| 11153 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11154 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 11155 | { |
| 11156 | struct alc_spec *spec = codec->spec; |
| 11157 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11158 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11159 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11160 | alc262_hippo_master_update(codec); |
| 11161 | } |
| 11162 | |
| 11163 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11164 | { |
| 11165 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11166 | return; |
| 11167 | alc262_hippo_automute(codec); |
| 11168 | } |
| 11169 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11170 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11171 | { |
| 11172 | struct alc_spec *spec = codec->spec; |
| 11173 | |
| 11174 | spec->autocfg.hp_pins[0] = 0x15; |
| 11175 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11176 | } |
| 11177 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11178 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11179 | { |
| 11180 | struct alc_spec *spec = codec->spec; |
| 11181 | |
| 11182 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11183 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11184 | } |
| 11185 | |
| 11186 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11187 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11188 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11189 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11190 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11191 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11192 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11193 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11194 | { } /* end */ |
| 11195 | }; |
| 11196 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11197 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11198 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11199 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11200 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11201 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11202 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11203 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11204 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11205 | { } /* end */ |
| 11206 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11207 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11208 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11209 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11210 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11211 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11212 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11213 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11214 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11215 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11216 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11217 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11218 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11219 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11220 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11221 | { } /* end */ |
| 11222 | }; |
| 11223 | |
| 11224 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11225 | /* Headphone automute */ |
| 11226 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11227 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11228 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11229 | |
| 11230 | /* P11 AUX_IN, white 4-pin connector */ |
| 11231 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11232 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11233 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11234 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11235 | |
| 11236 | {} |
| 11237 | }; |
| 11238 | |
| 11239 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11240 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11241 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11242 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11243 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11244 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11245 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11246 | } |
| 11247 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11248 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11249 | #define alc262_capture_mixer alc882_capture_mixer |
| 11250 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11251 | |
| 11252 | /* |
| 11253 | * generic initialization of ADC, input mixers and output mixers |
| 11254 | */ |
| 11255 | static struct hda_verb alc262_init_verbs[] = { |
| 11256 | /* |
| 11257 | * Unmute ADC0-2 and set the default input to mic-in |
| 11258 | */ |
| 11259 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11260 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11261 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11262 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11263 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11264 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11265 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11266 | /* 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] | 11267 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11268 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11269 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11270 | */ |
| 11271 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11272 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11273 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11274 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11275 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11276 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11277 | |
| 11278 | /* |
| 11279 | * Set up output mixers (0x0c - 0x0e) |
| 11280 | */ |
| 11281 | /* set vol=0 to output mixers */ |
| 11282 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11283 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11284 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11285 | /* set up input amps for analog loopback */ |
| 11286 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11287 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11288 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11289 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11290 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11291 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11292 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11293 | |
| 11294 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11295 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11296 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11297 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11298 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11299 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11300 | |
| 11301 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11302 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11303 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11304 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11305 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11306 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11307 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11308 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11309 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11310 | /* FIXME: use matrix-type input source selection */ |
| 11311 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11312 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11313 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11314 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11315 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11316 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11317 | /* Input mixer2 */ |
| 11318 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11319 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11320 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11321 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11322 | /* Input mixer3 */ |
| 11323 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11324 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11325 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11326 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11327 | |
| 11328 | { } |
| 11329 | }; |
| 11330 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11331 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11332 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11333 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11334 | { } |
| 11335 | }; |
| 11336 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11337 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11338 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11339 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11340 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11341 | |
| 11342 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11343 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11344 | {} |
| 11345 | }; |
| 11346 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11347 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11348 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11349 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11350 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11351 | |
| 11352 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11353 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11354 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11355 | }; |
| 11356 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11357 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11358 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11359 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11360 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11361 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11362 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11363 | { } /* end */ |
| 11364 | }; |
| 11365 | |
| 11366 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11367 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11368 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11369 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11370 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11371 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11372 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11373 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11374 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11375 | {} |
| 11376 | }; |
| 11377 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11378 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11379 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11380 | struct alc_spec *spec = codec->spec; |
| 11381 | |
| 11382 | spec->autocfg.hp_pins[0] = 0x15; |
| 11383 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11384 | spec->ext_mic.pin = 0x18; |
| 11385 | spec->ext_mic.mux_idx = 0; |
| 11386 | spec->int_mic.pin = 0x12; |
| 11387 | spec->int_mic.mux_idx = 9; |
| 11388 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11389 | } |
| 11390 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11391 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11392 | * nec model |
| 11393 | * 0x15 = headphone |
| 11394 | * 0x16 = internal speaker |
| 11395 | * 0x18 = external mic |
| 11396 | */ |
| 11397 | |
| 11398 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11399 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11400 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11401 | |
| 11402 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11403 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11404 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11405 | |
| 11406 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11407 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11408 | { } /* end */ |
| 11409 | }; |
| 11410 | |
| 11411 | static struct hda_verb alc262_nec_verbs[] = { |
| 11412 | /* Unmute Speaker */ |
| 11413 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11414 | |
| 11415 | /* Headphone */ |
| 11416 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11417 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11418 | |
| 11419 | /* External mic to headphone */ |
| 11420 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11421 | /* External mic to speaker */ |
| 11422 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11423 | {} |
| 11424 | }; |
| 11425 | |
| 11426 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11427 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11428 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11429 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11430 | */ |
| 11431 | |
| 11432 | #define ALC_HP_EVENT 0x37 |
| 11433 | |
| 11434 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11435 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11436 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11437 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11438 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11439 | {} |
| 11440 | }; |
| 11441 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11442 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11443 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11444 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11445 | {} |
| 11446 | }; |
| 11447 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11448 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11449 | /* Front Mic pin: input vref at 50% */ |
| 11450 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11451 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11452 | {} |
| 11453 | }; |
| 11454 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11455 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11456 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11457 | .items = { |
| 11458 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11459 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11460 | { "CD", 0x4 }, |
| 11461 | }, |
| 11462 | }; |
| 11463 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11464 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11465 | .num_items = 5, |
| 11466 | .items = { |
| 11467 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11468 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11469 | { "Line", 0x2 }, |
| 11470 | { "CD", 0x4 }, |
| 11471 | { "AUX IN", 0x6 }, |
| 11472 | }, |
| 11473 | }; |
| 11474 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11475 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11476 | .num_items = 4, |
| 11477 | .items = { |
| 11478 | { "Mic", 0x0 }, |
| 11479 | { "Front Mic", 0x2 }, |
| 11480 | { "Line", 0x1 }, |
| 11481 | { "CD", 0x4 }, |
| 11482 | }, |
| 11483 | }; |
| 11484 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11485 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11486 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11487 | { |
| 11488 | struct alc_spec *spec = codec->spec; |
| 11489 | unsigned int mute; |
| 11490 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11491 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11492 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11493 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11494 | spec->sense_updated = 1; |
| 11495 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11496 | /* unmute internal speaker only if both HPs are unplugged and |
| 11497 | * master switch is on |
| 11498 | */ |
| 11499 | if (spec->jack_present) |
| 11500 | mute = HDA_AMP_MUTE; |
| 11501 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11502 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11503 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11504 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11505 | } |
| 11506 | |
| 11507 | /* unsolicited event for HP jack sensing */ |
| 11508 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11509 | unsigned int res) |
| 11510 | { |
| 11511 | if ((res >> 26) != ALC_HP_EVENT) |
| 11512 | return; |
| 11513 | alc262_fujitsu_automute(codec, 1); |
| 11514 | } |
| 11515 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11516 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11517 | { |
| 11518 | alc262_fujitsu_automute(codec, 1); |
| 11519 | } |
| 11520 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11521 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11522 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11523 | .ops = &snd_hda_bind_vol, |
| 11524 | .values = { |
| 11525 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11526 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11527 | 0 |
| 11528 | }, |
| 11529 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11530 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11531 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11532 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11533 | { |
| 11534 | struct alc_spec *spec = codec->spec; |
| 11535 | unsigned int mute; |
| 11536 | |
| 11537 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11538 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11539 | spec->sense_updated = 1; |
| 11540 | } |
| 11541 | if (spec->jack_present) { |
| 11542 | /* mute internal speaker */ |
| 11543 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11544 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11545 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11546 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11547 | } else { |
| 11548 | /* unmute internal speaker if necessary */ |
| 11549 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11550 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11551 | HDA_AMP_MUTE, mute); |
| 11552 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11553 | HDA_AMP_MUTE, mute); |
| 11554 | } |
| 11555 | } |
| 11556 | |
| 11557 | /* unsolicited event for HP jack sensing */ |
| 11558 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11559 | unsigned int res) |
| 11560 | { |
| 11561 | if ((res >> 26) != ALC_HP_EVENT) |
| 11562 | return; |
| 11563 | alc262_lenovo_3000_automute(codec, 1); |
| 11564 | } |
| 11565 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11566 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11567 | int dir, int idx, long *valp) |
| 11568 | { |
| 11569 | int i, change = 0; |
| 11570 | |
| 11571 | for (i = 0; i < 2; i++, valp++) |
| 11572 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11573 | HDA_AMP_MUTE, |
| 11574 | *valp ? 0 : HDA_AMP_MUTE); |
| 11575 | return change; |
| 11576 | } |
| 11577 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11578 | /* bind hp and internal speaker mute (with plug check) */ |
| 11579 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11580 | struct snd_ctl_elem_value *ucontrol) |
| 11581 | { |
| 11582 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11583 | long *valp = ucontrol->value.integer.value; |
| 11584 | int change; |
| 11585 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11586 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11587 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11588 | if (change) |
| 11589 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11590 | return change; |
| 11591 | } |
| 11592 | |
| 11593 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11594 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11595 | { |
| 11596 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11597 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11598 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11599 | .info = snd_hda_mixer_amp_switch_info, |
| 11600 | .get = snd_hda_mixer_amp_switch_get, |
| 11601 | .put = alc262_fujitsu_master_sw_put, |
| 11602 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11603 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11604 | { |
| 11605 | .iface = NID_MAPPING, |
| 11606 | .name = "Master Playback Switch", |
| 11607 | .private_value = 0x1b, |
| 11608 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11609 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11610 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11611 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11612 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11613 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11614 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11615 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11616 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11617 | { } /* end */ |
| 11618 | }; |
| 11619 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11620 | /* bind hp and internal speaker mute (with plug check) */ |
| 11621 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11622 | struct snd_ctl_elem_value *ucontrol) |
| 11623 | { |
| 11624 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11625 | long *valp = ucontrol->value.integer.value; |
| 11626 | int change; |
| 11627 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11628 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11629 | if (change) |
| 11630 | alc262_lenovo_3000_automute(codec, 0); |
| 11631 | return change; |
| 11632 | } |
| 11633 | |
| 11634 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11635 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11636 | { |
| 11637 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11638 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11639 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11640 | .info = snd_hda_mixer_amp_switch_info, |
| 11641 | .get = snd_hda_mixer_amp_switch_get, |
| 11642 | .put = alc262_lenovo_3000_master_sw_put, |
| 11643 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11644 | }, |
| 11645 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11646 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11647 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11648 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11649 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11650 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11651 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11652 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11653 | { } /* end */ |
| 11654 | }; |
| 11655 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11656 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11657 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11658 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11659 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11660 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11661 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11662 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11663 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11664 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11665 | { } /* end */ |
| 11666 | }; |
| 11667 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11668 | /* additional init verbs for Benq laptops */ |
| 11669 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11670 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11671 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11672 | {} |
| 11673 | }; |
| 11674 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11675 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11676 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11677 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11678 | |
| 11679 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11680 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11681 | {} |
| 11682 | }; |
| 11683 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11684 | /* Samsung Q1 Ultra Vista model setup */ |
| 11685 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11686 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11687 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11688 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11689 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11690 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11691 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11692 | { } /* end */ |
| 11693 | }; |
| 11694 | |
| 11695 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11696 | /* output mixer */ |
| 11697 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11698 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11699 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11700 | /* speaker */ |
| 11701 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11702 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11703 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11704 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11705 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11706 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11707 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11708 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11709 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11710 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11711 | /* internal mic */ |
| 11712 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11713 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11714 | /* ADC, choose mic */ |
| 11715 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11716 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11717 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11718 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11719 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11720 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11721 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11722 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11723 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11724 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11725 | {} |
| 11726 | }; |
| 11727 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11728 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11729 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11730 | { |
| 11731 | struct alc_spec *spec = codec->spec; |
| 11732 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11733 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11734 | mute = 0; |
| 11735 | /* auto-mute only when HP is used as HP */ |
| 11736 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11737 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11738 | if (spec->jack_present) |
| 11739 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11740 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11741 | /* mute/unmute internal speaker */ |
| 11742 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11743 | HDA_AMP_MUTE, mute); |
| 11744 | /* mute/unmute HP */ |
| 11745 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11746 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11747 | } |
| 11748 | |
| 11749 | /* unsolicited event for HP jack sensing */ |
| 11750 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11751 | unsigned int res) |
| 11752 | { |
| 11753 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11754 | return; |
| 11755 | alc262_ultra_automute(codec); |
| 11756 | } |
| 11757 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11758 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 11759 | .num_items = 2, |
| 11760 | .items = { |
| 11761 | { "Mic", 0x1 }, |
| 11762 | { "Headphone", 0x7 }, |
| 11763 | }, |
| 11764 | }; |
| 11765 | |
| 11766 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11767 | struct snd_ctl_elem_value *ucontrol) |
| 11768 | { |
| 11769 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11770 | struct alc_spec *spec = codec->spec; |
| 11771 | int ret; |
| 11772 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11773 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11774 | if (!ret) |
| 11775 | return 0; |
| 11776 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 11777 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11778 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11779 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 11780 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 11781 | return ret; |
| 11782 | } |
| 11783 | |
| 11784 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 11785 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 11786 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 11787 | { |
| 11788 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11789 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11790 | .info = alc_mux_enum_info, |
| 11791 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11792 | .put = alc262_ultra_mux_enum_put, |
| 11793 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11794 | { |
| 11795 | .iface = NID_MAPPING, |
| 11796 | .name = "Capture Source", |
| 11797 | .private_value = 0x15, |
| 11798 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11799 | { } /* end */ |
| 11800 | }; |
| 11801 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11802 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 11803 | * and thus it's bound with a different mixer. |
| 11804 | * This function returns which mixer amp should be used. |
| 11805 | */ |
| 11806 | static int alc262_check_volbit(hda_nid_t nid) |
| 11807 | { |
| 11808 | if (!nid) |
| 11809 | return 0; |
| 11810 | else if (nid == 0x16) |
| 11811 | return 2; |
| 11812 | else |
| 11813 | return 1; |
| 11814 | } |
| 11815 | |
| 11816 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11817 | const char *pfx, int *vbits) |
| 11818 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11819 | unsigned long val; |
| 11820 | int vbit; |
| 11821 | |
| 11822 | vbit = alc262_check_volbit(nid); |
| 11823 | if (!vbit) |
| 11824 | return 0; |
| 11825 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 11826 | return 0; |
| 11827 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11828 | if (vbit == 2) |
| 11829 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 11830 | else |
| 11831 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11832 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11833 | } |
| 11834 | |
| 11835 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11836 | const char *pfx) |
| 11837 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11838 | unsigned long val; |
| 11839 | |
| 11840 | if (!nid) |
| 11841 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11842 | if (nid == 0x16) |
| 11843 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 11844 | else |
| 11845 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11846 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11847 | } |
| 11848 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11849 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11850 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11851 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11852 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11853 | const char *pfx; |
| 11854 | int vbits; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11855 | int err; |
| 11856 | |
| 11857 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11858 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11859 | spec->multiout.dac_nids[0] = 2; |
| 11860 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11861 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 11862 | pfx = "Master"; |
| 11863 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11864 | pfx = "Speaker"; |
| 11865 | else |
| 11866 | pfx = "Front"; |
| 11867 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); |
| 11868 | if (err < 0) |
| 11869 | return err; |
| 11870 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); |
| 11871 | if (err < 0) |
| 11872 | return err; |
| 11873 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); |
| 11874 | if (err < 0) |
| 11875 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11876 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11877 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 11878 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 11879 | alc262_check_volbit(cfg->hp_pins[0]); |
| 11880 | if (vbits == 1 || vbits == 2) |
| 11881 | pfx = "Master"; /* only one mixer is used */ |
| 11882 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11883 | pfx = "Speaker"; |
| 11884 | else |
| 11885 | pfx = "Front"; |
| 11886 | vbits = 0; |
| 11887 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); |
| 11888 | if (err < 0) |
| 11889 | return err; |
| 11890 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", |
| 11891 | &vbits); |
| 11892 | if (err < 0) |
| 11893 | return err; |
| 11894 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", |
| 11895 | &vbits); |
| 11896 | if (err < 0) |
| 11897 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11898 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11899 | } |
| 11900 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11901 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 11902 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11903 | |
| 11904 | /* |
| 11905 | * generic initialization of ADC, input mixers and output mixers |
| 11906 | */ |
| 11907 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 11908 | /* |
| 11909 | * Unmute ADC0-2 and set the default input to mic-in |
| 11910 | */ |
| 11911 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11912 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11913 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11914 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11915 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11916 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11917 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11918 | /* 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] | 11919 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11920 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11921 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11922 | */ |
| 11923 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11924 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11925 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11926 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11927 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11928 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11929 | |
| 11930 | /* |
| 11931 | * Set up output mixers (0x0c - 0x0f) |
| 11932 | */ |
| 11933 | /* set vol=0 to output mixers */ |
| 11934 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11935 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11936 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11937 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11938 | /* set up input amps for analog loopback */ |
| 11939 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11940 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11941 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11942 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11943 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11944 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11945 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11946 | |
| 11947 | /* FIXME: use matrix-type input source selection */ |
| 11948 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11949 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11950 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11951 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11952 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11953 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11954 | /* Input mixer2 */ |
| 11955 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11956 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11957 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11958 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11959 | /* Input mixer3 */ |
| 11960 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11961 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11962 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11963 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11964 | |
| 11965 | { } |
| 11966 | }; |
| 11967 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11968 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 11969 | /* |
| 11970 | * Unmute ADC0-2 and set the default input to mic-in |
| 11971 | */ |
| 11972 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11973 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11974 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11975 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11976 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11977 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11978 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11979 | /* 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] | 11980 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11981 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11982 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11983 | */ |
| 11984 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11985 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11986 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11987 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11988 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11989 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11990 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11991 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11992 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11993 | /* |
| 11994 | * Set up output mixers (0x0c - 0x0e) |
| 11995 | */ |
| 11996 | /* set vol=0 to output mixers */ |
| 11997 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11998 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11999 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12000 | |
| 12001 | /* set up input amps for analog loopback */ |
| 12002 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12003 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12004 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12005 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12006 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12007 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12008 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12009 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12010 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12011 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12012 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12013 | |
| 12014 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12015 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12016 | |
| 12017 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12018 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12019 | |
| 12020 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12021 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12022 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12023 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12024 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12025 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12026 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12027 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12028 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12029 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12030 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12031 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12032 | |
| 12033 | |
| 12034 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12035 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12036 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12037 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12038 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12039 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12040 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12041 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12042 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12043 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12044 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12045 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12046 | /* Input mixer2 */ |
| 12047 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12048 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12049 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12050 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12051 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12052 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12053 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12054 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12055 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12056 | /* Input mixer3 */ |
| 12057 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12058 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12059 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12060 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12061 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12062 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12063 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12064 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12065 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12066 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12067 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12068 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12069 | { } |
| 12070 | }; |
| 12071 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12072 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12073 | /* |
| 12074 | * Unmute ADC0-2 and set the default input to mic-in |
| 12075 | */ |
| 12076 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12077 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12078 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12079 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12080 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12081 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12082 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12083 | /* 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] | 12084 | * mixer widget |
| 12085 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12086 | * panel mic (mic 2) |
| 12087 | */ |
| 12088 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12089 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12090 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12091 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12092 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12093 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12094 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12095 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12096 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12097 | /* |
| 12098 | * Set up output mixers (0x0c - 0x0e) |
| 12099 | */ |
| 12100 | /* set vol=0 to output mixers */ |
| 12101 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12102 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12103 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12104 | |
| 12105 | /* set up input amps for analog loopback */ |
| 12106 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12107 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12108 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12109 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12110 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12111 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12112 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12113 | |
| 12114 | |
| 12115 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12116 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12117 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12118 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12119 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12120 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12121 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12122 | |
| 12123 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12124 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12125 | |
| 12126 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12127 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12128 | |
| 12129 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12130 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12131 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12132 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12133 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12134 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12135 | |
| 12136 | /* FIXME: use matrix-type input source selection */ |
| 12137 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12138 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12139 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12140 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12141 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12142 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12143 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12144 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12145 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12146 | /* Input mixer2 */ |
| 12147 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12148 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12149 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12150 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12151 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12152 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12153 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12154 | /* Input mixer3 */ |
| 12155 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12156 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12157 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12158 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12159 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12160 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12161 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12162 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12163 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12164 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12165 | { } |
| 12166 | }; |
| 12167 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12168 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12169 | |
| 12170 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12171 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12172 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12173 | |
| 12174 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12175 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12176 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12177 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12178 | |
| 12179 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12180 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12181 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12182 | {} |
| 12183 | }; |
| 12184 | |
| 12185 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12186 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12187 | #define alc262_loopbacks alc880_loopbacks |
| 12188 | #endif |
| 12189 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12190 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12191 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12192 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12193 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12194 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12195 | |
| 12196 | /* |
| 12197 | * BIOS auto configuration |
| 12198 | */ |
| 12199 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12200 | { |
| 12201 | struct alc_spec *spec = codec->spec; |
| 12202 | int err; |
| 12203 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12204 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12205 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12206 | alc262_ignore); |
| 12207 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12208 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12209 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12210 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12211 | spec->multiout.max_channels = 2; |
| 12212 | spec->no_analog = 1; |
| 12213 | goto dig_only; |
| 12214 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12215 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12216 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12217 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12218 | if (err < 0) |
| 12219 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12220 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12221 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12222 | return err; |
| 12223 | |
| 12224 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12225 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12226 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12227 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12228 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12229 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12230 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12231 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12232 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12233 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12234 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12235 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12236 | err = alc_auto_add_mic_boost(codec); |
| 12237 | if (err < 0) |
| 12238 | return err; |
| 12239 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12240 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12241 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12242 | return 1; |
| 12243 | } |
| 12244 | |
| 12245 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12246 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12247 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12248 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12249 | |
| 12250 | |
| 12251 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12252 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12253 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12254 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12255 | alc262_auto_init_multi_out(codec); |
| 12256 | alc262_auto_init_hp_out(codec); |
| 12257 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12258 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12259 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12260 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12261 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12262 | } |
| 12263 | |
| 12264 | /* |
| 12265 | * configuration and preset |
| 12266 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12267 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 12268 | [ALC262_BASIC] = "basic", |
| 12269 | [ALC262_HIPPO] = "hippo", |
| 12270 | [ALC262_HIPPO_1] = "hippo_1", |
| 12271 | [ALC262_FUJITSU] = "fujitsu", |
| 12272 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12273 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12274 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12275 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12276 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12277 | [ALC262_BENQ_T31] = "benq-t31", |
| 12278 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12279 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12280 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12281 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12282 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12283 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12284 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12285 | [ALC262_AUTO] = "auto", |
| 12286 | }; |
| 12287 | |
| 12288 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12289 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12290 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12291 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12292 | ALC262_HP_BPC), |
| 12293 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12294 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12295 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12296 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12297 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12298 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12299 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12300 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12301 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12302 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12303 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12304 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12305 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12306 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12307 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12308 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12309 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12310 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12311 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12312 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12313 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12314 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12315 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12316 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12317 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12318 | #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] | 12319 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12320 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12321 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12322 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12323 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12324 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12325 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12326 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12327 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12328 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12329 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12330 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12331 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12332 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12333 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12334 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12335 | {} |
| 12336 | }; |
| 12337 | |
| 12338 | static struct alc_config_preset alc262_presets[] = { |
| 12339 | [ALC262_BASIC] = { |
| 12340 | .mixers = { alc262_base_mixer }, |
| 12341 | .init_verbs = { alc262_init_verbs }, |
| 12342 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12343 | .dac_nids = alc262_dac_nids, |
| 12344 | .hp_nid = 0x03, |
| 12345 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12346 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12347 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12348 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12349 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12350 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12351 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12352 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12353 | .dac_nids = alc262_dac_nids, |
| 12354 | .hp_nid = 0x03, |
| 12355 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12356 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12357 | .channel_mode = alc262_modes, |
| 12358 | .input_mux = &alc262_capture_source, |
| 12359 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12360 | .setup = alc262_hippo_setup, |
| 12361 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12362 | }, |
| 12363 | [ALC262_HIPPO_1] = { |
| 12364 | .mixers = { alc262_hippo1_mixer }, |
| 12365 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12366 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12367 | .dac_nids = alc262_dac_nids, |
| 12368 | .hp_nid = 0x02, |
| 12369 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12370 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12371 | .channel_mode = alc262_modes, |
| 12372 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12373 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12374 | .setup = alc262_hippo1_setup, |
| 12375 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12376 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12377 | [ALC262_FUJITSU] = { |
| 12378 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12379 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12380 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12381 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12382 | .dac_nids = alc262_dac_nids, |
| 12383 | .hp_nid = 0x03, |
| 12384 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12385 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12386 | .channel_mode = alc262_modes, |
| 12387 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12388 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12389 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12390 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12391 | [ALC262_HP_BPC] = { |
| 12392 | .mixers = { alc262_HP_BPC_mixer }, |
| 12393 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12394 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12395 | .dac_nids = alc262_dac_nids, |
| 12396 | .hp_nid = 0x03, |
| 12397 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12398 | .channel_mode = alc262_modes, |
| 12399 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12400 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12401 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12402 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12403 | [ALC262_HP_BPC_D7000_WF] = { |
| 12404 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12405 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12406 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12407 | .dac_nids = alc262_dac_nids, |
| 12408 | .hp_nid = 0x03, |
| 12409 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12410 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12411 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12412 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12413 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12414 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12415 | [ALC262_HP_BPC_D7000_WL] = { |
| 12416 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12417 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12418 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12419 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12420 | .dac_nids = alc262_dac_nids, |
| 12421 | .hp_nid = 0x03, |
| 12422 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12423 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12424 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12425 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12426 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12427 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12428 | [ALC262_HP_TC_T5735] = { |
| 12429 | .mixers = { alc262_hp_t5735_mixer }, |
| 12430 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12431 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12432 | .dac_nids = alc262_dac_nids, |
| 12433 | .hp_nid = 0x03, |
| 12434 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12435 | .channel_mode = alc262_modes, |
| 12436 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12437 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12438 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12439 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12440 | }, |
| 12441 | [ALC262_HP_RP5700] = { |
| 12442 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12443 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12444 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12445 | .dac_nids = alc262_dac_nids, |
| 12446 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12447 | .channel_mode = alc262_modes, |
| 12448 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12449 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12450 | [ALC262_BENQ_ED8] = { |
| 12451 | .mixers = { alc262_base_mixer }, |
| 12452 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12453 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12454 | .dac_nids = alc262_dac_nids, |
| 12455 | .hp_nid = 0x03, |
| 12456 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12457 | .channel_mode = alc262_modes, |
| 12458 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12459 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12460 | [ALC262_SONY_ASSAMD] = { |
| 12461 | .mixers = { alc262_sony_mixer }, |
| 12462 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12463 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12464 | .dac_nids = alc262_dac_nids, |
| 12465 | .hp_nid = 0x02, |
| 12466 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12467 | .channel_mode = alc262_modes, |
| 12468 | .input_mux = &alc262_capture_source, |
| 12469 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12470 | .setup = alc262_hippo_setup, |
| 12471 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12472 | }, |
| 12473 | [ALC262_BENQ_T31] = { |
| 12474 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12475 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12476 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12477 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12478 | .dac_nids = alc262_dac_nids, |
| 12479 | .hp_nid = 0x03, |
| 12480 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12481 | .channel_mode = alc262_modes, |
| 12482 | .input_mux = &alc262_capture_source, |
| 12483 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12484 | .setup = alc262_hippo_setup, |
| 12485 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12486 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12487 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12488 | .mixers = { alc262_ultra_mixer }, |
| 12489 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12490 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12491 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12492 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12493 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12494 | .channel_mode = alc262_modes, |
| 12495 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12496 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12497 | .capsrc_nids = alc262_capsrc_nids, |
| 12498 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12499 | .unsol_event = alc262_ultra_unsol_event, |
| 12500 | .init_hook = alc262_ultra_automute, |
| 12501 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12502 | [ALC262_LENOVO_3000] = { |
| 12503 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12504 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12505 | alc262_lenovo_3000_unsol_verbs, |
| 12506 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12507 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12508 | .dac_nids = alc262_dac_nids, |
| 12509 | .hp_nid = 0x03, |
| 12510 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12511 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12512 | .channel_mode = alc262_modes, |
| 12513 | .input_mux = &alc262_fujitsu_capture_source, |
| 12514 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12515 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12516 | [ALC262_NEC] = { |
| 12517 | .mixers = { alc262_nec_mixer }, |
| 12518 | .init_verbs = { alc262_nec_verbs }, |
| 12519 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12520 | .dac_nids = alc262_dac_nids, |
| 12521 | .hp_nid = 0x03, |
| 12522 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12523 | .channel_mode = alc262_modes, |
| 12524 | .input_mux = &alc262_capture_source, |
| 12525 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12526 | [ALC262_TOSHIBA_S06] = { |
| 12527 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12528 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12529 | alc262_eapd_verbs }, |
| 12530 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12531 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12532 | .dac_nids = alc262_dac_nids, |
| 12533 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12534 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12535 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12536 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12537 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12538 | .unsol_event = alc_sku_unsol_event, |
| 12539 | .setup = alc262_toshiba_s06_setup, |
| 12540 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12541 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12542 | [ALC262_TOSHIBA_RX1] = { |
| 12543 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12544 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12545 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12546 | .dac_nids = alc262_dac_nids, |
| 12547 | .hp_nid = 0x03, |
| 12548 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12549 | .channel_mode = alc262_modes, |
| 12550 | .input_mux = &alc262_capture_source, |
| 12551 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12552 | .setup = alc262_hippo_setup, |
| 12553 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12554 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12555 | [ALC262_TYAN] = { |
| 12556 | .mixers = { alc262_tyan_mixer }, |
| 12557 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12558 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12559 | .dac_nids = alc262_dac_nids, |
| 12560 | .hp_nid = 0x02, |
| 12561 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12562 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12563 | .channel_mode = alc262_modes, |
| 12564 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12565 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12566 | .setup = alc262_tyan_setup, |
| 12567 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12568 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12569 | }; |
| 12570 | |
| 12571 | static int patch_alc262(struct hda_codec *codec) |
| 12572 | { |
| 12573 | struct alc_spec *spec; |
| 12574 | int board_config; |
| 12575 | int err; |
| 12576 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12577 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12578 | if (spec == NULL) |
| 12579 | return -ENOMEM; |
| 12580 | |
| 12581 | codec->spec = spec; |
| 12582 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12583 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12584 | * under-run |
| 12585 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12586 | { |
| 12587 | int tmp; |
| 12588 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12589 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12590 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12591 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12592 | } |
| 12593 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12594 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12595 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12596 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12597 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12598 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12599 | alc262_models, |
| 12600 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12601 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12602 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12603 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12604 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12605 | board_config = ALC262_AUTO; |
| 12606 | } |
| 12607 | |
| 12608 | if (board_config == ALC262_AUTO) { |
| 12609 | /* automatic parse from the BIOS config */ |
| 12610 | err = alc262_parse_auto_config(codec); |
| 12611 | if (err < 0) { |
| 12612 | alc_free(codec); |
| 12613 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12614 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12615 | printk(KERN_INFO |
| 12616 | "hda_codec: Cannot set up configuration " |
| 12617 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12618 | board_config = ALC262_BASIC; |
| 12619 | } |
| 12620 | } |
| 12621 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12622 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12623 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12624 | if (err < 0) { |
| 12625 | alc_free(codec); |
| 12626 | return err; |
| 12627 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12628 | } |
| 12629 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12630 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12631 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12632 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12633 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12634 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12635 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12636 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12637 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12638 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12639 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12640 | int i; |
| 12641 | /* check whether the digital-mic has to be supported */ |
| 12642 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12643 | if (spec->input_mux->items[i].index >= 9) |
| 12644 | break; |
| 12645 | } |
| 12646 | if (i < spec->input_mux->num_items) { |
| 12647 | /* use only ADC0 */ |
| 12648 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12649 | spec->num_adc_nids = 1; |
| 12650 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12651 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12652 | /* all analog inputs */ |
| 12653 | /* check whether NID 0x07 is valid */ |
| 12654 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12655 | |
| 12656 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12657 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12658 | if (wcap != AC_WID_AUD_IN) { |
| 12659 | spec->adc_nids = alc262_adc_nids_alt; |
| 12660 | spec->num_adc_nids = |
| 12661 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12662 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12663 | } else { |
| 12664 | spec->adc_nids = alc262_adc_nids; |
| 12665 | spec->num_adc_nids = |
| 12666 | ARRAY_SIZE(alc262_adc_nids); |
| 12667 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12668 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12669 | } |
| 12670 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12671 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12672 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12673 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12674 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12675 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12676 | spec->vmaster_nid = 0x0c; |
| 12677 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12678 | codec->patch_ops = alc_patch_ops; |
| 12679 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12680 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12681 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12682 | if (!spec->loopback.amplist) |
| 12683 | spec->loopback.amplist = alc262_loopbacks; |
| 12684 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12685 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12686 | return 0; |
| 12687 | } |
| 12688 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12689 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12690 | * ALC268 channel source setting (2 channel) |
| 12691 | */ |
| 12692 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12693 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12694 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12695 | static hda_nid_t alc268_dac_nids[2] = { |
| 12696 | /* front, hp */ |
| 12697 | 0x02, 0x03 |
| 12698 | }; |
| 12699 | |
| 12700 | static hda_nid_t alc268_adc_nids[2] = { |
| 12701 | /* ADC0-1 */ |
| 12702 | 0x08, 0x07 |
| 12703 | }; |
| 12704 | |
| 12705 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 12706 | /* ADC0 */ |
| 12707 | 0x08 |
| 12708 | }; |
| 12709 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12710 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 12711 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12712 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 12713 | /* output mixer control */ |
| 12714 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12715 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12716 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12717 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12718 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12719 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12720 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12721 | { } |
| 12722 | }; |
| 12723 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12724 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 12725 | /* output mixer control */ |
| 12726 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12727 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12728 | ALC262_HIPPO_MASTER_SWITCH, |
| 12729 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12730 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12731 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12732 | { } |
| 12733 | }; |
| 12734 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12735 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 12736 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 12737 | .ops = &snd_hda_bind_sw, |
| 12738 | .values = { |
| 12739 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 12740 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 12741 | 0 |
| 12742 | }, |
| 12743 | }; |
| 12744 | |
| 12745 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 12746 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 12747 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 12748 | { } |
| 12749 | }; |
| 12750 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12751 | static struct hda_verb alc268_eapd_verbs[] = { |
| 12752 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12753 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12754 | { } |
| 12755 | }; |
| 12756 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12757 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12758 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 12759 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12760 | { } /* end */ |
| 12761 | }; |
| 12762 | |
| 12763 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12764 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 12765 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 12766 | .ops = &snd_hda_bind_vol, |
| 12767 | .values = { |
| 12768 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12769 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12770 | 0 |
| 12771 | }, |
| 12772 | }; |
| 12773 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12774 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12775 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 12776 | { |
| 12777 | struct alc_spec *spec = codec->spec; |
| 12778 | unsigned int mute; |
| 12779 | |
| 12780 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12781 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12782 | spec->sense_updated = 1; |
| 12783 | } |
| 12784 | if (spec->jack_present) |
| 12785 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 12786 | else /* unmute internal speaker if necessary */ |
| 12787 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 12788 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12789 | HDA_AMP_MUTE, mute); |
| 12790 | } |
| 12791 | |
| 12792 | |
| 12793 | /* bind hp and internal speaker mute (with plug check) */ |
| 12794 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 12795 | struct snd_ctl_elem_value *ucontrol) |
| 12796 | { |
| 12797 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12798 | long *valp = ucontrol->value.integer.value; |
| 12799 | int change; |
| 12800 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 12801 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12802 | if (change) |
| 12803 | alc268_acer_automute(codec, 0); |
| 12804 | return change; |
| 12805 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12806 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12807 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 12808 | /* output mixer control */ |
| 12809 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12810 | { |
| 12811 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12812 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12813 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12814 | .info = snd_hda_mixer_amp_switch_info, |
| 12815 | .get = snd_hda_mixer_amp_switch_get, |
| 12816 | .put = alc268_acer_master_sw_put, |
| 12817 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12818 | }, |
| 12819 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 12820 | { } |
| 12821 | }; |
| 12822 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12823 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 12824 | /* output mixer control */ |
| 12825 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12826 | { |
| 12827 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12828 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12829 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12830 | .info = snd_hda_mixer_amp_switch_info, |
| 12831 | .get = snd_hda_mixer_amp_switch_get, |
| 12832 | .put = alc268_acer_master_sw_put, |
| 12833 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12834 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12835 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12836 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12837 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12838 | { } |
| 12839 | }; |
| 12840 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12841 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 12842 | /* output mixer control */ |
| 12843 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12844 | { |
| 12845 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12846 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12847 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12848 | .info = snd_hda_mixer_amp_switch_info, |
| 12849 | .get = snd_hda_mixer_amp_switch_get, |
| 12850 | .put = alc268_acer_master_sw_put, |
| 12851 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12852 | }, |
| 12853 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12854 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12855 | { } |
| 12856 | }; |
| 12857 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12858 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 12859 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12860 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12861 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12862 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12863 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 12864 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 12865 | { } |
| 12866 | }; |
| 12867 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12868 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12869 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 12870 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12871 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12872 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12873 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12874 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12875 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12876 | { } |
| 12877 | }; |
| 12878 | |
| 12879 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12880 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12881 | #define alc268_toshiba_setup alc262_hippo_setup |
| 12882 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12883 | |
| 12884 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 12885 | unsigned int res) |
| 12886 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12887 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12888 | return; |
| 12889 | alc268_acer_automute(codec, 1); |
| 12890 | } |
| 12891 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12892 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 12893 | { |
| 12894 | alc268_acer_automute(codec, 1); |
| 12895 | } |
| 12896 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12897 | /* toggle speaker-output according to the hp-jack state */ |
| 12898 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 12899 | { |
| 12900 | unsigned int present; |
| 12901 | unsigned char bits; |
| 12902 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12903 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12904 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12905 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12906 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12907 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12908 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12909 | } |
| 12910 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12911 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 12912 | unsigned int res) |
| 12913 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12914 | switch (res >> 26) { |
| 12915 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12916 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12917 | break; |
| 12918 | case ALC880_MIC_EVENT: |
| 12919 | alc_mic_automute(codec); |
| 12920 | break; |
| 12921 | } |
| 12922 | } |
| 12923 | |
| 12924 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 12925 | { |
| 12926 | struct alc_spec *spec = codec->spec; |
| 12927 | spec->ext_mic.pin = 0x18; |
| 12928 | spec->ext_mic.mux_idx = 0; |
| 12929 | spec->int_mic.pin = 0x12; |
| 12930 | spec->int_mic.mux_idx = 6; |
| 12931 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12932 | } |
| 12933 | |
| 12934 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 12935 | { |
| 12936 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12937 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12938 | } |
| 12939 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12940 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 12941 | /* output mixer control */ |
| 12942 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12943 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12944 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12945 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12946 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12947 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12948 | { } |
| 12949 | }; |
| 12950 | |
| 12951 | static struct hda_verb alc268_dell_verbs[] = { |
| 12952 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12953 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12954 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12955 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12956 | { } |
| 12957 | }; |
| 12958 | |
| 12959 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12960 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12961 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12962 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12963 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12964 | spec->autocfg.hp_pins[0] = 0x15; |
| 12965 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12966 | spec->ext_mic.pin = 0x18; |
| 12967 | spec->ext_mic.mux_idx = 0; |
| 12968 | spec->int_mic.pin = 0x19; |
| 12969 | spec->int_mic.mux_idx = 1; |
| 12970 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12971 | } |
| 12972 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12973 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 12974 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12975 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12976 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12977 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12978 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12979 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12980 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12981 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12982 | { } |
| 12983 | }; |
| 12984 | |
| 12985 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 12986 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12987 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 12988 | { } |
| 12989 | }; |
| 12990 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12991 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12992 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12993 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12994 | spec->autocfg.hp_pins[0] = 0x15; |
| 12995 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12996 | spec->ext_mic.pin = 0x18; |
| 12997 | spec->ext_mic.mux_idx = 0; |
| 12998 | spec->int_mic.pin = 0x19; |
| 12999 | spec->int_mic.mux_idx = 1; |
| 13000 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13001 | } |
| 13002 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13003 | /* |
| 13004 | * generic initialization of ADC, input mixers and output mixers |
| 13005 | */ |
| 13006 | static struct hda_verb alc268_base_init_verbs[] = { |
| 13007 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13008 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13009 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13010 | |
| 13011 | /* |
| 13012 | * Set up output mixers (0x0c - 0x0e) |
| 13013 | */ |
| 13014 | /* set vol=0 to output mixers */ |
| 13015 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13016 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13017 | |
| 13018 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13019 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13020 | |
| 13021 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13022 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13023 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13024 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13025 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13026 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13027 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13028 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13029 | |
| 13030 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13031 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13032 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13033 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13034 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13035 | |
| 13036 | /* set PCBEEP vol = 0, mute connections */ |
| 13037 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13038 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13039 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13040 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13041 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13042 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13043 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13044 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13045 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13046 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13047 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13048 | { } |
| 13049 | }; |
| 13050 | |
| 13051 | /* |
| 13052 | * generic initialization of ADC, input mixers and output mixers |
| 13053 | */ |
| 13054 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 13055 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13056 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13057 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13058 | |
| 13059 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13060 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13061 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13062 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13063 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13064 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13065 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13066 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13067 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13068 | |
| 13069 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13070 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13071 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13072 | /* set PCBEEP vol = 0, mute connections */ |
| 13073 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13074 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13075 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13076 | |
| 13077 | { } |
| 13078 | }; |
| 13079 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13080 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13081 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13082 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13083 | { } /* end */ |
| 13084 | }; |
| 13085 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13086 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13087 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13088 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13089 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13090 | { } /* end */ |
| 13091 | }; |
| 13092 | |
| 13093 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13094 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13095 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13096 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13097 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13098 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13099 | { } /* end */ |
| 13100 | }; |
| 13101 | |
| 13102 | static struct hda_input_mux alc268_capture_source = { |
| 13103 | .num_items = 4, |
| 13104 | .items = { |
| 13105 | { "Mic", 0x0 }, |
| 13106 | { "Front Mic", 0x1 }, |
| 13107 | { "Line", 0x2 }, |
| 13108 | { "CD", 0x3 }, |
| 13109 | }, |
| 13110 | }; |
| 13111 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13112 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13113 | .num_items = 3, |
| 13114 | .items = { |
| 13115 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13116 | { "Internal Mic", 0x1 }, |
| 13117 | { "Line", 0x2 }, |
| 13118 | }, |
| 13119 | }; |
| 13120 | |
| 13121 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13122 | .num_items = 3, |
| 13123 | .items = { |
| 13124 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13125 | { "Internal Mic", 0x6 }, |
| 13126 | { "Line", 0x2 }, |
| 13127 | }, |
| 13128 | }; |
| 13129 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13130 | #ifdef CONFIG_SND_DEBUG |
| 13131 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13132 | /* Volume widgets */ |
| 13133 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13134 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13135 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13136 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13137 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13138 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13139 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13140 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13141 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13142 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13143 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13144 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13145 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13146 | /* The below appears problematic on some hardwares */ |
| 13147 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13148 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13149 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13150 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13151 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13152 | |
| 13153 | /* Modes for retasking pin widgets */ |
| 13154 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13155 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13156 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13157 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13158 | |
| 13159 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13160 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13161 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13162 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13163 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13164 | |
| 13165 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13166 | * The ALC268 does not have an SPDIF input. |
| 13167 | */ |
| 13168 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13169 | |
| 13170 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13171 | * this output to turn on an external amplifier. |
| 13172 | */ |
| 13173 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13174 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13175 | |
| 13176 | { } /* end */ |
| 13177 | }; |
| 13178 | #endif |
| 13179 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13180 | /* create input playback/capture controls for the given pin */ |
| 13181 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13182 | const char *ctlname, int idx) |
| 13183 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13184 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13185 | int err; |
| 13186 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13187 | switch (nid) { |
| 13188 | case 0x14: |
| 13189 | case 0x16: |
| 13190 | dac = 0x02; |
| 13191 | break; |
| 13192 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13193 | case 0x1a: /* ALC259/269 only */ |
| 13194 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13195 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13196 | dac = 0x03; |
| 13197 | break; |
| 13198 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13199 | snd_printd(KERN_WARNING "hda_codec: " |
| 13200 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13201 | return 0; |
| 13202 | } |
| 13203 | if (spec->multiout.dac_nids[0] != dac && |
| 13204 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13205 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13206 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13207 | HDA_OUTPUT)); |
| 13208 | if (err < 0) |
| 13209 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13210 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13211 | } |
| 13212 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13213 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13214 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13215 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13216 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13217 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13218 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13219 | if (err < 0) |
| 13220 | return err; |
| 13221 | return 0; |
| 13222 | } |
| 13223 | |
| 13224 | /* add playback controls from the parsed DAC table */ |
| 13225 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13226 | const struct auto_pin_cfg *cfg) |
| 13227 | { |
| 13228 | hda_nid_t nid; |
| 13229 | int err; |
| 13230 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13231 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13232 | |
| 13233 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13234 | if (nid) { |
| 13235 | const char *name; |
| 13236 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13237 | name = "Speaker"; |
| 13238 | else |
| 13239 | name = "Front"; |
| 13240 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13241 | if (err < 0) |
| 13242 | return err; |
| 13243 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13244 | |
| 13245 | nid = cfg->speaker_pins[0]; |
| 13246 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13247 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13248 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13249 | if (err < 0) |
| 13250 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13251 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13252 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13253 | if (err < 0) |
| 13254 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13255 | } |
| 13256 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13257 | if (nid) { |
| 13258 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13259 | if (err < 0) |
| 13260 | return err; |
| 13261 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13262 | |
| 13263 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13264 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13265 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13266 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13267 | if (err < 0) |
| 13268 | return err; |
| 13269 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13270 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13271 | } |
| 13272 | |
| 13273 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13274 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13275 | const struct auto_pin_cfg *cfg) |
| 13276 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13277 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13278 | } |
| 13279 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13280 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13281 | hda_nid_t nid, int pin_type) |
| 13282 | { |
| 13283 | int idx; |
| 13284 | |
| 13285 | alc_set_pin_output(codec, nid, pin_type); |
| 13286 | if (nid == 0x14 || nid == 0x16) |
| 13287 | idx = 0; |
| 13288 | else |
| 13289 | idx = 1; |
| 13290 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13291 | } |
| 13292 | |
| 13293 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13294 | { |
| 13295 | struct alc_spec *spec = codec->spec; |
| 13296 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 13297 | if (nid) { |
| 13298 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13299 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13300 | } |
| 13301 | } |
| 13302 | |
| 13303 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13304 | { |
| 13305 | struct alc_spec *spec = codec->spec; |
| 13306 | hda_nid_t pin; |
| 13307 | |
| 13308 | pin = spec->autocfg.hp_pins[0]; |
| 13309 | if (pin) |
| 13310 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 13311 | pin = spec->autocfg.speaker_pins[0]; |
| 13312 | if (pin) |
| 13313 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 13314 | } |
| 13315 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13316 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13317 | { |
| 13318 | struct alc_spec *spec = codec->spec; |
| 13319 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13320 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13321 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13322 | unsigned int dac_vol1, dac_vol2; |
| 13323 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13324 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13325 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13326 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13327 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13328 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13329 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13330 | AMP_IN_UNMUTE(1)); |
| 13331 | snd_hda_codec_write(codec, 0x10, 0, |
| 13332 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13333 | AMP_IN_UNMUTE(1)); |
| 13334 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13335 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13336 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13337 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13338 | snd_hda_codec_write(codec, 0x10, 0, |
| 13339 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13340 | } |
| 13341 | |
| 13342 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13343 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13344 | dac_vol2 = AMP_OUT_ZERO; |
| 13345 | else if (line_nid == 0x15) |
| 13346 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13347 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13348 | dac_vol2 = AMP_OUT_ZERO; |
| 13349 | else if (hp_nid == 0x15) |
| 13350 | dac_vol1 = AMP_OUT_ZERO; |
| 13351 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13352 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13353 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13354 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13355 | |
| 13356 | snd_hda_codec_write(codec, 0x02, 0, |
| 13357 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13358 | snd_hda_codec_write(codec, 0x03, 0, |
| 13359 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13360 | } |
| 13361 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13362 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13363 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13364 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13365 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13366 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13367 | |
| 13368 | /* |
| 13369 | * BIOS auto configuration |
| 13370 | */ |
| 13371 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13372 | { |
| 13373 | struct alc_spec *spec = codec->spec; |
| 13374 | int err; |
| 13375 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13376 | |
| 13377 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13378 | alc268_ignore); |
| 13379 | if (err < 0) |
| 13380 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13381 | if (!spec->autocfg.line_outs) { |
| 13382 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13383 | spec->multiout.max_channels = 2; |
| 13384 | spec->no_analog = 1; |
| 13385 | goto dig_only; |
| 13386 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13387 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13388 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13389 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13390 | if (err < 0) |
| 13391 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13392 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13393 | if (err < 0) |
| 13394 | return err; |
| 13395 | |
| 13396 | spec->multiout.max_channels = 2; |
| 13397 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13398 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13399 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13400 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13401 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13402 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13403 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13404 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13405 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13406 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13407 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13408 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13409 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13410 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13411 | err = alc_auto_add_mic_boost(codec); |
| 13412 | if (err < 0) |
| 13413 | return err; |
| 13414 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13415 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13416 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13417 | return 1; |
| 13418 | } |
| 13419 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13420 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13421 | |
| 13422 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13423 | static void alc268_auto_init(struct hda_codec *codec) |
| 13424 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13425 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13426 | alc268_auto_init_multi_out(codec); |
| 13427 | alc268_auto_init_hp_out(codec); |
| 13428 | alc268_auto_init_mono_speaker_out(codec); |
| 13429 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13430 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13431 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13432 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13433 | } |
| 13434 | |
| 13435 | /* |
| 13436 | * configuration and preset |
| 13437 | */ |
| 13438 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13439 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13440 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13441 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13442 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13443 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13444 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13445 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13446 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13447 | #ifdef CONFIG_SND_DEBUG |
| 13448 | [ALC268_TEST] = "test", |
| 13449 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13450 | [ALC268_AUTO] = "auto", |
| 13451 | }; |
| 13452 | |
| 13453 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13454 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13455 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13456 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13457 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13458 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13459 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13460 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13461 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13462 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13463 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13464 | /* almost compatible with toshiba but with optional digital outs; |
| 13465 | * auto-probing seems working fine |
| 13466 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13467 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13468 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13469 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13470 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13471 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13472 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13473 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13474 | {} |
| 13475 | }; |
| 13476 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13477 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13478 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13479 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13480 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13481 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13482 | ALC268_TOSHIBA), |
| 13483 | {} |
| 13484 | }; |
| 13485 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13486 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13487 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13488 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13489 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13490 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13491 | alc267_quanta_il1_verbs }, |
| 13492 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13493 | .dac_nids = alc268_dac_nids, |
| 13494 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13495 | .adc_nids = alc268_adc_nids_alt, |
| 13496 | .hp_nid = 0x03, |
| 13497 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13498 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13499 | .unsol_event = alc_sku_unsol_event, |
| 13500 | .setup = alc267_quanta_il1_setup, |
| 13501 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13502 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13503 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13504 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13505 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13506 | .init_verbs = { alc268_base_init_verbs }, |
| 13507 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13508 | .dac_nids = alc268_dac_nids, |
| 13509 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13510 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13511 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13512 | .hp_nid = 0x03, |
| 13513 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13514 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13515 | .channel_mode = alc268_modes, |
| 13516 | .input_mux = &alc268_capture_source, |
| 13517 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13518 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13519 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13520 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13521 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13522 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13523 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13524 | .dac_nids = alc268_dac_nids, |
| 13525 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13526 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13527 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13528 | .hp_nid = 0x03, |
| 13529 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13530 | .channel_mode = alc268_modes, |
| 13531 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13532 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13533 | .setup = alc268_toshiba_setup, |
| 13534 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13535 | }, |
| 13536 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13537 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13538 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13539 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13540 | alc268_acer_verbs }, |
| 13541 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13542 | .dac_nids = alc268_dac_nids, |
| 13543 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13544 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13545 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13546 | .hp_nid = 0x02, |
| 13547 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13548 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13549 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13550 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13551 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13552 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13553 | [ALC268_ACER_DMIC] = { |
| 13554 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13555 | alc268_beep_mixer }, |
| 13556 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13557 | alc268_acer_verbs }, |
| 13558 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13559 | .dac_nids = alc268_dac_nids, |
| 13560 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13561 | .adc_nids = alc268_adc_nids_alt, |
| 13562 | .capsrc_nids = alc268_capsrc_nids, |
| 13563 | .hp_nid = 0x02, |
| 13564 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13565 | .channel_mode = alc268_modes, |
| 13566 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13567 | .unsol_event = alc268_acer_unsol_event, |
| 13568 | .init_hook = alc268_acer_init_hook, |
| 13569 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13570 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13571 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13572 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13573 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13574 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13575 | alc268_acer_aspire_one_verbs }, |
| 13576 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13577 | .dac_nids = alc268_dac_nids, |
| 13578 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13579 | .adc_nids = alc268_adc_nids_alt, |
| 13580 | .capsrc_nids = alc268_capsrc_nids, |
| 13581 | .hp_nid = 0x03, |
| 13582 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13583 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13584 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13585 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13586 | .init_hook = alc268_acer_lc_init_hook, |
| 13587 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13588 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13589 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13590 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13591 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13592 | alc268_dell_verbs }, |
| 13593 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13594 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13595 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13596 | .adc_nids = alc268_adc_nids_alt, |
| 13597 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13598 | .hp_nid = 0x02, |
| 13599 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13600 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13601 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13602 | .setup = alc268_dell_setup, |
| 13603 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13604 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13605 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13606 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13607 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13608 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13609 | alc268_toshiba_verbs }, |
| 13610 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13611 | .dac_nids = alc268_dac_nids, |
| 13612 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13613 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13614 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13615 | .hp_nid = 0x03, |
| 13616 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13617 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13618 | .channel_mode = alc268_modes, |
| 13619 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13620 | .setup = alc268_toshiba_setup, |
| 13621 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13622 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13623 | #ifdef CONFIG_SND_DEBUG |
| 13624 | [ALC268_TEST] = { |
| 13625 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13626 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13627 | alc268_volume_init_verbs }, |
| 13628 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13629 | .dac_nids = alc268_dac_nids, |
| 13630 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13631 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13632 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13633 | .hp_nid = 0x03, |
| 13634 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13635 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13636 | .channel_mode = alc268_modes, |
| 13637 | .input_mux = &alc268_capture_source, |
| 13638 | }, |
| 13639 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13640 | }; |
| 13641 | |
| 13642 | static int patch_alc268(struct hda_codec *codec) |
| 13643 | { |
| 13644 | struct alc_spec *spec; |
| 13645 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13646 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13647 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13648 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13649 | if (spec == NULL) |
| 13650 | return -ENOMEM; |
| 13651 | |
| 13652 | codec->spec = spec; |
| 13653 | |
| 13654 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13655 | alc268_models, |
| 13656 | alc268_cfg_tbl); |
| 13657 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13658 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13659 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13660 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13661 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13662 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13663 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13664 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13665 | board_config = ALC268_AUTO; |
| 13666 | } |
| 13667 | |
| 13668 | if (board_config == ALC268_AUTO) { |
| 13669 | /* automatic parse from the BIOS config */ |
| 13670 | err = alc268_parse_auto_config(codec); |
| 13671 | if (err < 0) { |
| 13672 | alc_free(codec); |
| 13673 | return err; |
| 13674 | } else if (!err) { |
| 13675 | printk(KERN_INFO |
| 13676 | "hda_codec: Cannot set up configuration " |
| 13677 | "from BIOS. Using base mode...\n"); |
| 13678 | board_config = ALC268_3ST; |
| 13679 | } |
| 13680 | } |
| 13681 | |
| 13682 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13683 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13684 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13685 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 13686 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13687 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13688 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13689 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 13690 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13691 | has_beep = 0; |
| 13692 | for (i = 0; i < spec->num_mixers; i++) { |
| 13693 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 13694 | has_beep = 1; |
| 13695 | break; |
| 13696 | } |
| 13697 | } |
| 13698 | |
| 13699 | if (has_beep) { |
| 13700 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13701 | if (err < 0) { |
| 13702 | alc_free(codec); |
| 13703 | return err; |
| 13704 | } |
| 13705 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 13706 | /* override the amp caps for beep generator */ |
| 13707 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13708 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 13709 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 13710 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 13711 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13712 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13713 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13714 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13715 | /* check whether NID 0x07 is valid */ |
| 13716 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13717 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13718 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13719 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13720 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13721 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13722 | if (spec->auto_mic || |
| 13723 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13724 | spec->adc_nids = alc268_adc_nids_alt; |
| 13725 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13726 | if (spec->auto_mic) |
| 13727 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13728 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 13729 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 13730 | else |
| 13731 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13732 | } else { |
| 13733 | spec->adc_nids = alc268_adc_nids; |
| 13734 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13735 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13736 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13737 | /* set default input source */ |
| 13738 | for (i = 0; i < spec->num_adc_nids; i++) |
| 13739 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 13740 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13741 | i < spec->num_mux_defs ? |
| 13742 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13743 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13744 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13745 | |
| 13746 | spec->vmaster_nid = 0x02; |
| 13747 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13748 | codec->patch_ops = alc_patch_ops; |
| 13749 | if (board_config == ALC268_AUTO) |
| 13750 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13751 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13752 | return 0; |
| 13753 | } |
| 13754 | |
| 13755 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13756 | * ALC269 channel source setting (2 channel) |
| 13757 | */ |
| 13758 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 13759 | |
| 13760 | #define alc269_dac_nids alc260_dac_nids |
| 13761 | |
| 13762 | static hda_nid_t alc269_adc_nids[1] = { |
| 13763 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13764 | 0x08, |
| 13765 | }; |
| 13766 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13767 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 13768 | 0x23, |
| 13769 | }; |
| 13770 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13771 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 13772 | /* ADC1 */ |
| 13773 | 0x09, |
| 13774 | }; |
| 13775 | |
| 13776 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 13777 | 0x22, |
| 13778 | }; |
| 13779 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 13780 | static hda_nid_t alc269_adc_candidates[] = { |
| 13781 | 0x08, 0x09, 0x07, |
| 13782 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13783 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13784 | #define alc269_modes alc260_modes |
| 13785 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 13786 | |
| 13787 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 13788 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13789 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13790 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13791 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13792 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13793 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13794 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13795 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13796 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13797 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13798 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13799 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 13800 | { } /* end */ |
| 13801 | }; |
| 13802 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13803 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 13804 | /* output mixer control */ |
| 13805 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13806 | { |
| 13807 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13808 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13809 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13810 | .info = snd_hda_mixer_amp_switch_info, |
| 13811 | .get = snd_hda_mixer_amp_switch_get, |
| 13812 | .put = alc268_acer_master_sw_put, |
| 13813 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13814 | }, |
| 13815 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13816 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13817 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13818 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13819 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13820 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13821 | { } |
| 13822 | }; |
| 13823 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13824 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 13825 | /* output mixer control */ |
| 13826 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13827 | { |
| 13828 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13829 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13830 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13831 | .info = snd_hda_mixer_amp_switch_info, |
| 13832 | .get = snd_hda_mixer_amp_switch_get, |
| 13833 | .put = alc268_acer_master_sw_put, |
| 13834 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13835 | }, |
| 13836 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13837 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13838 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13839 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13840 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13841 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13842 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 13843 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 13844 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13845 | { } |
| 13846 | }; |
| 13847 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13848 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13849 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13850 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13851 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13852 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13853 | { } /* end */ |
| 13854 | }; |
| 13855 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13856 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 13857 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13858 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13859 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13860 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13861 | { } /* end */ |
| 13862 | }; |
| 13863 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 13864 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
| 13865 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13866 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 13867 | { } /* end */ |
| 13868 | }; |
| 13869 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13870 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13871 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 13872 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13873 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 13874 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13875 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13876 | { } /* end */ |
| 13877 | }; |
| 13878 | |
| 13879 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13880 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13881 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13882 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13883 | { } /* end */ |
| 13884 | }; |
| 13885 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13886 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 13887 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13888 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13889 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13890 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13891 | { } /* end */ |
| 13892 | }; |
| 13893 | |
| 13894 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 13895 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13896 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13897 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13898 | { } /* end */ |
| 13899 | }; |
| 13900 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13901 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13902 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13903 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13904 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 13905 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13906 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13907 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13908 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13909 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13910 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13911 | { } |
| 13912 | }; |
| 13913 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13914 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 13915 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13916 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13917 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13918 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13919 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13920 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13921 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13922 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13923 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13924 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13925 | { } |
| 13926 | }; |
| 13927 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13928 | /* toggle speaker-output according to the hp-jack state */ |
| 13929 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 13930 | { |
| 13931 | unsigned int present; |
| 13932 | unsigned char bits; |
| 13933 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13934 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13935 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13936 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13937 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13938 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13939 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13940 | |
| 13941 | snd_hda_codec_write(codec, 0x20, 0, |
| 13942 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13943 | snd_hda_codec_write(codec, 0x20, 0, |
| 13944 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13945 | |
| 13946 | snd_hda_codec_write(codec, 0x20, 0, |
| 13947 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13948 | snd_hda_codec_write(codec, 0x20, 0, |
| 13949 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13950 | } |
| 13951 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13952 | /* toggle speaker-output according to the hp-jacks state */ |
| 13953 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 13954 | { |
| 13955 | unsigned int present; |
| 13956 | unsigned char bits; |
| 13957 | |
| 13958 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13959 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13960 | |
| 13961 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13962 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13963 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13964 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13965 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13966 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13967 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13968 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13969 | |
| 13970 | snd_hda_codec_write(codec, 0x20, 0, |
| 13971 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13972 | snd_hda_codec_write(codec, 0x20, 0, |
| 13973 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13974 | |
| 13975 | snd_hda_codec_write(codec, 0x20, 0, |
| 13976 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13977 | snd_hda_codec_write(codec, 0x20, 0, |
| 13978 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13979 | } |
| 13980 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13981 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 13982 | { |
| 13983 | unsigned int present_laptop; |
| 13984 | unsigned int present_dock; |
| 13985 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13986 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 13987 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13988 | |
| 13989 | /* Laptop mic port overrides dock mic port, design decision */ |
| 13990 | if (present_dock) |
| 13991 | snd_hda_codec_write(codec, 0x23, 0, |
| 13992 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 13993 | if (present_laptop) |
| 13994 | snd_hda_codec_write(codec, 0x23, 0, |
| 13995 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 13996 | if (!present_dock && !present_laptop) |
| 13997 | snd_hda_codec_write(codec, 0x23, 0, |
| 13998 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 13999 | } |
| 14000 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14001 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14002 | unsigned int res) |
| 14003 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14004 | switch (res >> 26) { |
| 14005 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14006 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14007 | break; |
| 14008 | case ALC880_MIC_EVENT: |
| 14009 | alc_mic_automute(codec); |
| 14010 | break; |
| 14011 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14012 | } |
| 14013 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14014 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14015 | unsigned int res) |
| 14016 | { |
| 14017 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14018 | alc269_lifebook_speaker_automute(codec); |
| 14019 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14020 | alc269_lifebook_mic_autoswitch(codec); |
| 14021 | } |
| 14022 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14023 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14024 | { |
| 14025 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14026 | spec->autocfg.hp_pins[0] = 0x15; |
| 14027 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14028 | spec->ext_mic.pin = 0x18; |
| 14029 | spec->ext_mic.mux_idx = 0; |
| 14030 | spec->int_mic.pin = 0x19; |
| 14031 | spec->int_mic.mux_idx = 1; |
| 14032 | spec->auto_mic = 1; |
| 14033 | } |
| 14034 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14035 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14036 | { |
| 14037 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14038 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14039 | } |
| 14040 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14041 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14042 | { |
| 14043 | alc269_lifebook_speaker_automute(codec); |
| 14044 | alc269_lifebook_mic_autoswitch(codec); |
| 14045 | } |
| 14046 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14047 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14048 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14049 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14050 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14051 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14052 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14053 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14054 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14055 | {} |
| 14056 | }; |
| 14057 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14058 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14059 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14060 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14061 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14062 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14063 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14064 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14065 | {} |
| 14066 | }; |
| 14067 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14068 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 14069 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14070 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14071 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14072 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14073 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14074 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14075 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14076 | {} |
| 14077 | }; |
| 14078 | |
| 14079 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14080 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14081 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14082 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14083 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14084 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14085 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14086 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14087 | {} |
| 14088 | }; |
| 14089 | |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14090 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
| 14091 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14092 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14093 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14094 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14095 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14096 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14097 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14098 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14099 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14100 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14101 | { } |
| 14102 | }; |
| 14103 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14104 | /* toggle speaker-output according to the hp-jack state */ |
| 14105 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 14106 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14107 | struct alc_spec *spec = codec->spec; |
| 14108 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14109 | unsigned int present; |
| 14110 | unsigned char bits; |
| 14111 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14112 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14113 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14114 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14115 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14116 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14117 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14118 | } |
| 14119 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14120 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14121 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14122 | unsigned int res) |
| 14123 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14124 | switch (res >> 26) { |
| 14125 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14126 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14127 | break; |
| 14128 | case ALC880_MIC_EVENT: |
| 14129 | alc_mic_automute(codec); |
| 14130 | break; |
| 14131 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14132 | } |
| 14133 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14134 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14135 | { |
| 14136 | struct alc_spec *spec = codec->spec; |
| 14137 | spec->autocfg.hp_pins[0] = 0x15; |
| 14138 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14139 | spec->ext_mic.pin = 0x18; |
| 14140 | spec->ext_mic.mux_idx = 0; |
| 14141 | spec->int_mic.pin = 0x19; |
| 14142 | spec->int_mic.mux_idx = 1; |
| 14143 | spec->auto_mic = 1; |
| 14144 | } |
| 14145 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14146 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14147 | { |
| 14148 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14149 | spec->autocfg.hp_pins[0] = 0x15; |
| 14150 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14151 | spec->ext_mic.pin = 0x18; |
| 14152 | spec->ext_mic.mux_idx = 0; |
| 14153 | spec->int_mic.pin = 0x12; |
| 14154 | spec->int_mic.mux_idx = 5; |
| 14155 | spec->auto_mic = 1; |
| 14156 | } |
| 14157 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14158 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14159 | { |
| 14160 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14161 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14162 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14163 | spec->ext_mic.pin = 0x18; |
| 14164 | spec->ext_mic.mux_idx = 0; |
| 14165 | spec->int_mic.pin = 0x19; |
| 14166 | spec->int_mic.mux_idx = 1; |
| 14167 | spec->auto_mic = 1; |
| 14168 | } |
| 14169 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14170 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14171 | { |
| 14172 | struct alc_spec *spec = codec->spec; |
| 14173 | spec->autocfg.hp_pins[0] = 0x21; |
| 14174 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14175 | spec->ext_mic.pin = 0x18; |
| 14176 | spec->ext_mic.mux_idx = 0; |
| 14177 | spec->int_mic.pin = 0x12; |
| 14178 | spec->int_mic.mux_idx = 6; |
| 14179 | spec->auto_mic = 1; |
| 14180 | } |
| 14181 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14182 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14183 | { |
| 14184 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14185 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14186 | } |
| 14187 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14188 | /* |
| 14189 | * generic initialization of ADC, input mixers and output mixers |
| 14190 | */ |
| 14191 | static struct hda_verb alc269_init_verbs[] = { |
| 14192 | /* |
| 14193 | * Unmute ADC0 and set the default input to mic-in |
| 14194 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14195 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14196 | |
| 14197 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14198 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14199 | */ |
| 14200 | /* set vol=0 to output mixers */ |
| 14201 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14202 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14203 | |
| 14204 | /* set up input amps for analog loopback */ |
| 14205 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14206 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14207 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14208 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14209 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14210 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14211 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14212 | |
| 14213 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14214 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14215 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14216 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14217 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14218 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14219 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14220 | |
| 14221 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14222 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14223 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14224 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14225 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14226 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14227 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14228 | |
| 14229 | /* set EAPD */ |
| 14230 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14231 | { } |
| 14232 | }; |
| 14233 | |
| 14234 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14235 | /* |
| 14236 | * Unmute ADC0 and set the default input to mic-in |
| 14237 | */ |
| 14238 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14239 | |
| 14240 | /* |
| 14241 | * Set up output mixers (0x02 - 0x03) |
| 14242 | */ |
| 14243 | /* set vol=0 to output mixers */ |
| 14244 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14245 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14246 | |
| 14247 | /* set up input amps for analog loopback */ |
| 14248 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14249 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14250 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14251 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14252 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14253 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14254 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14255 | |
| 14256 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14257 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14258 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14259 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14260 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14261 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14262 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14263 | |
| 14264 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14265 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14266 | |
| 14267 | /* FIXME: use Mux-type input source selection */ |
| 14268 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14269 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14270 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14271 | |
| 14272 | /* set EAPD */ |
| 14273 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14274 | { } |
| 14275 | }; |
| 14276 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14277 | #define alc269_auto_create_multi_out_ctls \ |
| 14278 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14279 | #define alc269_auto_create_input_ctls \ |
| 14280 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14281 | |
| 14282 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14283 | #define alc269_loopbacks alc880_loopbacks |
| 14284 | #endif |
| 14285 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14286 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14287 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14288 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14289 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14290 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14291 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14292 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14293 | .substreams = 1, |
| 14294 | .channels_min = 2, |
| 14295 | .channels_max = 8, |
| 14296 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14297 | /* NID is set in alc_build_pcms */ |
| 14298 | .ops = { |
| 14299 | .open = alc880_playback_pcm_open, |
| 14300 | .prepare = alc880_playback_pcm_prepare, |
| 14301 | .cleanup = alc880_playback_pcm_cleanup |
| 14302 | }, |
| 14303 | }; |
| 14304 | |
| 14305 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14306 | .substreams = 1, |
| 14307 | .channels_min = 2, |
| 14308 | .channels_max = 2, |
| 14309 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14310 | /* NID is set in alc_build_pcms */ |
| 14311 | }; |
| 14312 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14313 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14314 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14315 | { |
| 14316 | switch (codec->subsystem_id) { |
| 14317 | case 0x103c1586: |
| 14318 | return 1; |
| 14319 | } |
| 14320 | return 0; |
| 14321 | } |
| 14322 | |
| 14323 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14324 | { |
| 14325 | /* update mute-LED according to the speaker mute state */ |
| 14326 | if (nid == 0x01 || nid == 0x14) { |
| 14327 | int pinval; |
| 14328 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14329 | HDA_AMP_MUTE) |
| 14330 | pinval = 0x24; |
| 14331 | else |
| 14332 | pinval = 0x20; |
| 14333 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a54 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14334 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14335 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14336 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14337 | } |
| 14338 | return alc_check_power_status(codec, nid); |
| 14339 | } |
| 14340 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14341 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14342 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14343 | { |
| 14344 | struct alc_spec *spec = codec->spec; |
| 14345 | |
| 14346 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14347 | return 0; |
| 14348 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14349 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14350 | if (spec->ext_mic.pin <= 0x12) { |
| 14351 | spec->private_adc_nids[0] = 0x08; |
| 14352 | spec->private_adc_nids[1] = 0x11; |
| 14353 | spec->private_capsrc_nids[0] = 0x23; |
| 14354 | spec->private_capsrc_nids[1] = 0x22; |
| 14355 | } else { |
| 14356 | spec->private_adc_nids[0] = 0x11; |
| 14357 | spec->private_adc_nids[1] = 0x08; |
| 14358 | spec->private_capsrc_nids[0] = 0x22; |
| 14359 | spec->private_capsrc_nids[1] = 0x23; |
| 14360 | } |
| 14361 | spec->adc_nids = spec->private_adc_nids; |
| 14362 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14363 | spec->num_adc_nids = 2; |
| 14364 | spec->dual_adc_switch = 1; |
| 14365 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14366 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14367 | return 1; |
| 14368 | } |
| 14369 | return 0; |
| 14370 | } |
| 14371 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14372 | /* |
| 14373 | * BIOS auto configuration |
| 14374 | */ |
| 14375 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14376 | { |
| 14377 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14378 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14379 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14380 | |
| 14381 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14382 | alc269_ignore); |
| 14383 | if (err < 0) |
| 14384 | return err; |
| 14385 | |
| 14386 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14387 | if (err < 0) |
| 14388 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14389 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14390 | if (err < 0) |
| 14391 | return err; |
| 14392 | |
| 14393 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14394 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14395 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14396 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14397 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14398 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14399 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14400 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { |
| 14401 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14402 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14403 | } else { |
| 14404 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14405 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14406 | } |
| 14407 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14408 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14409 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14410 | |
| 14411 | if (!alc275_setup_dual_adc(codec)) |
| 14412 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14413 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14414 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14415 | /* set default input source */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14416 | if (!spec->dual_adc_switch) |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 14417 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], |
| 14418 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14419 | |
| 14420 | err = alc_auto_add_mic_boost(codec); |
| 14421 | if (err < 0) |
| 14422 | return err; |
| 14423 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14424 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14425 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14426 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14427 | return 1; |
| 14428 | } |
| 14429 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14430 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14431 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14432 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14433 | |
| 14434 | |
| 14435 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14436 | static void alc269_auto_init(struct hda_codec *codec) |
| 14437 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14438 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14439 | alc269_auto_init_multi_out(codec); |
| 14440 | alc269_auto_init_hp_out(codec); |
| 14441 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14442 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14443 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14444 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14445 | } |
| 14446 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14447 | enum { |
| 14448 | ALC269_FIXUP_SONY_VAIO, |
| 14449 | }; |
| 14450 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14451 | static const struct alc_fixup alc269_fixups[] = { |
| 14452 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame^] | 14453 | .verbs = (const struct hda_verb[]) { |
| 14454 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14455 | {} |
| 14456 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14457 | }, |
| 14458 | }; |
| 14459 | |
| 14460 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
| 14461 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | dbbcbc0 | 2010-08-23 08:14:35 +0200 | [diff] [blame] | 14462 | SND_PCI_QUIRK(0x104d, 0x9077, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14463 | {} |
| 14464 | }; |
| 14465 | |
| 14466 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14467 | /* |
| 14468 | * configuration and preset |
| 14469 | */ |
| 14470 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14471 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14472 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14473 | [ALC269_AMIC] = "laptop-amic", |
| 14474 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14475 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14476 | [ALC269_LIFEBOOK] = "lifebook", |
| 14477 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14478 | }; |
| 14479 | |
| 14480 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14481 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14482 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14483 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14484 | ALC269_AMIC), |
| 14485 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14486 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14487 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14488 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14489 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14490 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14491 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14492 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14493 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 14494 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 14495 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14496 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14497 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14498 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14499 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14500 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14501 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14502 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14503 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14504 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14505 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14506 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14507 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14508 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14509 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14510 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14511 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14512 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14513 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14514 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14515 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14516 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14517 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14518 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14519 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14520 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14521 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14522 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14523 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14524 | ALC269_DMIC), |
| 14525 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14526 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14527 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14528 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14529 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14530 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14531 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14532 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14533 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14534 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14535 | {} |
| 14536 | }; |
| 14537 | |
| 14538 | static struct alc_config_preset alc269_presets[] = { |
| 14539 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14540 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14541 | .init_verbs = { alc269_init_verbs }, |
| 14542 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14543 | .dac_nids = alc269_dac_nids, |
| 14544 | .hp_nid = 0x03, |
| 14545 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14546 | .channel_mode = alc269_modes, |
| 14547 | .input_mux = &alc269_capture_source, |
| 14548 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14549 | [ALC269_QUANTA_FL1] = { |
| 14550 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14551 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14552 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14553 | .dac_nids = alc269_dac_nids, |
| 14554 | .hp_nid = 0x03, |
| 14555 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14556 | .channel_mode = alc269_modes, |
| 14557 | .input_mux = &alc269_capture_source, |
| 14558 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14559 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14560 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14561 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14562 | [ALC269_AMIC] = { |
| 14563 | .mixers = { alc269_laptop_mixer }, |
| 14564 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14565 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14566 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14567 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14568 | .dac_nids = alc269_dac_nids, |
| 14569 | .hp_nid = 0x03, |
| 14570 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14571 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14572 | .unsol_event = alc269_laptop_unsol_event, |
| 14573 | .setup = alc269_laptop_amic_setup, |
| 14574 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14575 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14576 | [ALC269_DMIC] = { |
| 14577 | .mixers = { alc269_laptop_mixer }, |
| 14578 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14579 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14580 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14581 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14582 | .dac_nids = alc269_dac_nids, |
| 14583 | .hp_nid = 0x03, |
| 14584 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14585 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14586 | .unsol_event = alc269_laptop_unsol_event, |
| 14587 | .setup = alc269_laptop_dmic_setup, |
| 14588 | .init_hook = alc269_laptop_inithook, |
| 14589 | }, |
| 14590 | [ALC269VB_AMIC] = { |
| 14591 | .mixers = { alc269vb_laptop_mixer }, |
| 14592 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 14593 | .init_verbs = { alc269vb_init_verbs, |
| 14594 | alc269vb_laptop_amic_init_verbs }, |
| 14595 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14596 | .dac_nids = alc269_dac_nids, |
| 14597 | .hp_nid = 0x03, |
| 14598 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14599 | .channel_mode = alc269_modes, |
| 14600 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14601 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14602 | .init_hook = alc269_laptop_inithook, |
| 14603 | }, |
| 14604 | [ALC269VB_DMIC] = { |
| 14605 | .mixers = { alc269vb_laptop_mixer }, |
| 14606 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14607 | .init_verbs = { alc269vb_init_verbs, |
| 14608 | alc269vb_laptop_dmic_init_verbs }, |
| 14609 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14610 | .dac_nids = alc269_dac_nids, |
| 14611 | .hp_nid = 0x03, |
| 14612 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14613 | .channel_mode = alc269_modes, |
| 14614 | .unsol_event = alc269_laptop_unsol_event, |
| 14615 | .setup = alc269vb_laptop_dmic_setup, |
| 14616 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14617 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14618 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14619 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14620 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14621 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14622 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14623 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14624 | .dac_nids = alc269_dac_nids, |
| 14625 | .hp_nid = 0x03, |
| 14626 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14627 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14628 | .unsol_event = alc269_laptop_unsol_event, |
| 14629 | .setup = alc269_laptop_dmic_setup, |
| 14630 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14631 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14632 | [ALC269_LIFEBOOK] = { |
| 14633 | .mixers = { alc269_lifebook_mixer }, |
| 14634 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 14635 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14636 | .dac_nids = alc269_dac_nids, |
| 14637 | .hp_nid = 0x03, |
| 14638 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14639 | .channel_mode = alc269_modes, |
| 14640 | .input_mux = &alc269_capture_source, |
| 14641 | .unsol_event = alc269_lifebook_unsol_event, |
| 14642 | .init_hook = alc269_lifebook_init_hook, |
| 14643 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14644 | [ALC271_ACER] = { |
| 14645 | .mixers = { alc269_asus_mixer }, |
| 14646 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14647 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 14648 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14649 | .dac_nids = alc269_dac_nids, |
| 14650 | .adc_nids = alc262_dmic_adc_nids, |
| 14651 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 14652 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 14653 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14654 | .channel_mode = alc269_modes, |
| 14655 | .input_mux = &alc269_capture_source, |
| 14656 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 14657 | .unsol_event = alc_sku_unsol_event, |
| 14658 | .setup = alc269vb_laptop_dmic_setup, |
| 14659 | .init_hook = alc_inithook, |
| 14660 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14661 | }; |
| 14662 | |
| 14663 | static int patch_alc269(struct hda_codec *codec) |
| 14664 | { |
| 14665 | struct alc_spec *spec; |
| 14666 | int board_config; |
| 14667 | int err; |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14668 | int is_alc269vb = 0; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14669 | |
| 14670 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14671 | if (spec == NULL) |
| 14672 | return -ENOMEM; |
| 14673 | |
| 14674 | codec->spec = spec; |
| 14675 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14676 | alc_auto_parse_customize_define(codec); |
| 14677 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14678 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14679 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 14680 | spec->cdefine.platform_type == 1) |
| 14681 | alc_codec_rename(codec, "ALC271X"); |
| 14682 | else |
| 14683 | alc_codec_rename(codec, "ALC259"); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14684 | is_alc269vb = 1; |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14685 | } else |
| 14686 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14687 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14688 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 14689 | alc269_models, |
| 14690 | alc269_cfg_tbl); |
| 14691 | |
| 14692 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14693 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14694 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14695 | board_config = ALC269_AUTO; |
| 14696 | } |
| 14697 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14698 | if (board_config == ALC269_AUTO) |
| 14699 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); |
| 14700 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14701 | if (board_config == ALC269_AUTO) { |
| 14702 | /* automatic parse from the BIOS config */ |
| 14703 | err = alc269_parse_auto_config(codec); |
| 14704 | if (err < 0) { |
| 14705 | alc_free(codec); |
| 14706 | return err; |
| 14707 | } else if (!err) { |
| 14708 | printk(KERN_INFO |
| 14709 | "hda_codec: Cannot set up configuration " |
| 14710 | "from BIOS. Using base mode...\n"); |
| 14711 | board_config = ALC269_BASIC; |
| 14712 | } |
| 14713 | } |
| 14714 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 14715 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 14716 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14717 | if (err < 0) { |
| 14718 | alc_free(codec); |
| 14719 | return err; |
| 14720 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14721 | } |
| 14722 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14723 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14724 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14725 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14726 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14727 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 14728 | * fix the sample rate of analog I/O to 44.1kHz |
| 14729 | */ |
| 14730 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 14731 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14732 | } else if (spec->dual_adc_switch) { |
| 14733 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14734 | /* switch ADC dynamically */ |
| 14735 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14736 | } else { |
| 14737 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14738 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 14739 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14740 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 14741 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 14742 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14743 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
| 14744 | if (!is_alc269vb) { |
| 14745 | spec->adc_nids = alc269_adc_nids; |
| 14746 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 14747 | spec->capsrc_nids = alc269_capsrc_nids; |
| 14748 | } else { |
| 14749 | spec->adc_nids = alc269vb_adc_nids; |
| 14750 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 14751 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 14752 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14753 | } |
| 14754 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14755 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14756 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 14757 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14758 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14759 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14760 | if (board_config == ALC269_AUTO) |
| 14761 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); |
| 14762 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 14763 | spec->vmaster_nid = 0x02; |
| 14764 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14765 | codec->patch_ops = alc_patch_ops; |
| 14766 | if (board_config == ALC269_AUTO) |
| 14767 | spec->init_hook = alc269_auto_init; |
| 14768 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14769 | if (!spec->loopback.amplist) |
| 14770 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14771 | if (alc269_mic2_for_mute_led(codec)) |
| 14772 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14773 | #endif |
| 14774 | |
| 14775 | return 0; |
| 14776 | } |
| 14777 | |
| 14778 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14779 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 14780 | */ |
| 14781 | |
| 14782 | /* |
| 14783 | * set the path ways for 2 channel output |
| 14784 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 14785 | */ |
| 14786 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 14787 | /* set pin widget 1Ah (line in) for input */ |
| 14788 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14789 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14790 | * the vref |
| 14791 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14792 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14793 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14794 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14795 | #if 0 |
| 14796 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14797 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14798 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14799 | { } /* end */ |
| 14800 | }; |
| 14801 | /* |
| 14802 | * 6ch mode |
| 14803 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 14804 | */ |
| 14805 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 14806 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14807 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14808 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14809 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14810 | |
| 14811 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14812 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14813 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14814 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14815 | #if 0 |
| 14816 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14817 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14818 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14819 | { } /* end */ |
| 14820 | }; |
| 14821 | |
| 14822 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 14823 | { 2, alc861_threestack_ch2_init }, |
| 14824 | { 6, alc861_threestack_ch6_init }, |
| 14825 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14826 | /* Set mic1 as input and unmute the mixer */ |
| 14827 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 14828 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14829 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14830 | { } /* end */ |
| 14831 | }; |
| 14832 | /* Set mic1 as output and mute mixer */ |
| 14833 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 14834 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14835 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14836 | { } /* end */ |
| 14837 | }; |
| 14838 | |
| 14839 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 14840 | { 2, alc861_uniwill_m31_ch2_init }, |
| 14841 | { 4, alc861_uniwill_m31_ch4_init }, |
| 14842 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14843 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14844 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 14845 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 14846 | /* set pin widget 1Ah (line in) for input */ |
| 14847 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14848 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14849 | * the vref |
| 14850 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14851 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14852 | |
| 14853 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14854 | #if 0 |
| 14855 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14856 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14857 | #endif |
| 14858 | { } /* end */ |
| 14859 | }; |
| 14860 | /* Set mic1 nad line-in as output and mute mixer */ |
| 14861 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 14862 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14863 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14864 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14865 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14866 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14867 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14868 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14869 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14870 | |
| 14871 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14872 | #if 0 |
| 14873 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14874 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14875 | #endif |
| 14876 | { } /* end */ |
| 14877 | }; |
| 14878 | |
| 14879 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 14880 | { 2, alc861_asus_ch2_init }, |
| 14881 | { 6, alc861_asus_ch6_init }, |
| 14882 | }; |
| 14883 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14884 | /* patch-ALC861 */ |
| 14885 | |
| 14886 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 14887 | /* output mixer control */ |
| 14888 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14889 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14890 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14891 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14892 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14893 | |
| 14894 | /*Input mixer control */ |
| 14895 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14896 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14897 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14898 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14899 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14900 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14901 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14902 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14903 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14904 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14905 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14906 | { } /* end */ |
| 14907 | }; |
| 14908 | |
| 14909 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 14910 | /* output mixer control */ |
| 14911 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14912 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14913 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14914 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14915 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14916 | |
| 14917 | /* Input mixer control */ |
| 14918 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14919 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14920 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14921 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14922 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14923 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14924 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14925 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14926 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14927 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14928 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14929 | { |
| 14930 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14931 | .name = "Channel Mode", |
| 14932 | .info = alc_ch_mode_info, |
| 14933 | .get = alc_ch_mode_get, |
| 14934 | .put = alc_ch_mode_put, |
| 14935 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 14936 | }, |
| 14937 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14938 | }; |
| 14939 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14940 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14941 | /* output mixer control */ |
| 14942 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14943 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14944 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14945 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14946 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14947 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14948 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14949 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 14950 | /* output mixer control */ |
| 14951 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14952 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14953 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14954 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14955 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14956 | |
| 14957 | /* Input mixer control */ |
| 14958 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14959 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14960 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14961 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14962 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14963 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14964 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14965 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14966 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14967 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14968 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14969 | { |
| 14970 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14971 | .name = "Channel Mode", |
| 14972 | .info = alc_ch_mode_info, |
| 14973 | .get = alc_ch_mode_get, |
| 14974 | .put = alc_ch_mode_put, |
| 14975 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14976 | }, |
| 14977 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14978 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14979 | |
| 14980 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 14981 | /* output mixer control */ |
| 14982 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14983 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14984 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14985 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14986 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14987 | |
| 14988 | /* Input mixer control */ |
| 14989 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14990 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14991 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14992 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14993 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14994 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14995 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14996 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14997 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14998 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 14999 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15000 | { |
| 15001 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15002 | .name = "Channel Mode", |
| 15003 | .info = alc_ch_mode_info, |
| 15004 | .get = alc_ch_mode_get, |
| 15005 | .put = alc_ch_mode_put, |
| 15006 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15007 | }, |
| 15008 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15009 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15010 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15011 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 15012 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15013 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15014 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15015 | { } |
| 15016 | }; |
| 15017 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15018 | /* |
| 15019 | * generic initialization of ADC, input mixers and output mixers |
| 15020 | */ |
| 15021 | static struct hda_verb alc861_base_init_verbs[] = { |
| 15022 | /* |
| 15023 | * Unmute ADC0 and set the default input to mic-in |
| 15024 | */ |
| 15025 | /* port-A for surround (rear panel) */ |
| 15026 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15027 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15028 | /* port-B for mic-in (rear panel) with vref */ |
| 15029 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15030 | /* port-C for line-in (rear panel) */ |
| 15031 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15032 | /* port-D for Front */ |
| 15033 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15034 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15035 | /* port-E for HP out (front panel) */ |
| 15036 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15037 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15038 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15039 | /* port-F for mic-in (front panel) with vref */ |
| 15040 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15041 | /* port-G for CLFE (rear panel) */ |
| 15042 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15043 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15044 | /* port-H for side (rear panel) */ |
| 15045 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15046 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15047 | /* CD-in */ |
| 15048 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15049 | /* route front mic to ADC1*/ |
| 15050 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15051 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15052 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15053 | /* Unmute DAC0~3 & spdif out*/ |
| 15054 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15055 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15056 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15057 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15058 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
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 Mixer 14 (mic) 1c (Line in)*/ |
| 15061 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15062 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15063 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15064 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15065 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15066 | /* Unmute Stereo Mixer 15 */ |
| 15067 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15068 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15069 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15070 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15071 | |
| 15072 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15073 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15074 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15075 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15076 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15077 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15078 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15079 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15080 | /* hp used DAC 3 (Front) */ |
| 15081 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15082 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15083 | |
| 15084 | { } |
| 15085 | }; |
| 15086 | |
| 15087 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 15088 | /* |
| 15089 | * Unmute ADC0 and set the default input to mic-in |
| 15090 | */ |
| 15091 | /* port-A for surround (rear panel) */ |
| 15092 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15093 | /* port-B for mic-in (rear panel) with vref */ |
| 15094 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15095 | /* port-C for line-in (rear panel) */ |
| 15096 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15097 | /* port-D for Front */ |
| 15098 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15099 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15100 | /* port-E for HP out (front panel) */ |
| 15101 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15102 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15103 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15104 | /* port-F for mic-in (front panel) with vref */ |
| 15105 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15106 | /* port-G for CLFE (rear panel) */ |
| 15107 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15108 | /* port-H for side (rear panel) */ |
| 15109 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15110 | /* CD-in */ |
| 15111 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15112 | /* route front mic to ADC1*/ |
| 15113 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15114 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15115 | /* Unmute DAC0~3 & spdif out*/ |
| 15116 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15117 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15118 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15119 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15120 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15121 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15122 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15123 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15124 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15125 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15126 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15127 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15128 | /* Unmute Stereo Mixer 15 */ |
| 15129 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15130 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15131 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15132 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15133 | |
| 15134 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15135 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15136 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15137 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15138 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15139 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15140 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15141 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15142 | /* hp used DAC 3 (Front) */ |
| 15143 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15144 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15145 | { } |
| 15146 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15147 | |
| 15148 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15149 | /* |
| 15150 | * Unmute ADC0 and set the default input to mic-in |
| 15151 | */ |
| 15152 | /* port-A for surround (rear panel) */ |
| 15153 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15154 | /* port-B for mic-in (rear panel) with vref */ |
| 15155 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15156 | /* port-C for line-in (rear panel) */ |
| 15157 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15158 | /* port-D for Front */ |
| 15159 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15160 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15161 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15162 | /* this has to be set to VREF80 */ |
| 15163 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15164 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15165 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15166 | /* port-F for mic-in (front panel) with vref */ |
| 15167 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15168 | /* port-G for CLFE (rear panel) */ |
| 15169 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15170 | /* port-H for side (rear panel) */ |
| 15171 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15172 | /* CD-in */ |
| 15173 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15174 | /* route front mic to ADC1*/ |
| 15175 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15176 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15177 | /* Unmute DAC0~3 & spdif out*/ |
| 15178 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15179 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15180 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15181 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15182 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15183 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15184 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15185 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15186 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15187 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15188 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15189 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15190 | /* Unmute Stereo Mixer 15 */ |
| 15191 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15192 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15193 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15194 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15195 | |
| 15196 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15197 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15198 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15199 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15200 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15201 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15202 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15203 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15204 | /* hp used DAC 3 (Front) */ |
| 15205 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15206 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15207 | { } |
| 15208 | }; |
| 15209 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15210 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15211 | /* |
| 15212 | * Unmute ADC0 and set the default input to mic-in |
| 15213 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15214 | /* port-A for surround (rear panel) |
| 15215 | * according to codec#0 this is the HP jack |
| 15216 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15217 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15218 | /* route front PCM to HP */ |
| 15219 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15220 | /* port-B for mic-in (rear panel) with vref */ |
| 15221 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15222 | /* port-C for line-in (rear panel) */ |
| 15223 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15224 | /* port-D for Front */ |
| 15225 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15226 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15227 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15228 | /* this has to be set to VREF80 */ |
| 15229 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15230 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15231 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15232 | /* port-F for mic-in (front panel) with vref */ |
| 15233 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15234 | /* port-G for CLFE (rear panel) */ |
| 15235 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15236 | /* port-H for side (rear panel) */ |
| 15237 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15238 | /* CD-in */ |
| 15239 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15240 | /* route front mic to ADC1*/ |
| 15241 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15242 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15243 | /* Unmute DAC0~3 & spdif out*/ |
| 15244 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15245 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15246 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15247 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15248 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15249 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15250 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15251 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15252 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15253 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15254 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15255 | /* Unmute Stereo Mixer 15 */ |
| 15256 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15257 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15258 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15259 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15260 | |
| 15261 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15262 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15263 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15264 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15265 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15266 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15267 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15268 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15269 | /* hp used DAC 3 (Front) */ |
| 15270 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15271 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15272 | { } |
| 15273 | }; |
| 15274 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15275 | /* additional init verbs for ASUS laptops */ |
| 15276 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15277 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15278 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15279 | { } |
| 15280 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15281 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15282 | /* |
| 15283 | * generic initialization of ADC, input mixers and output mixers |
| 15284 | */ |
| 15285 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15286 | /* |
| 15287 | * Unmute ADC0 and set the default input to mic-in |
| 15288 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15289 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15290 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15291 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15292 | /* Unmute DAC0~3 & spdif out*/ |
| 15293 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15294 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15295 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15296 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15297 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
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 Mixer 14 (mic) 1c (Line in)*/ |
| 15300 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15301 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15302 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15303 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15304 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15305 | /* Unmute Stereo Mixer 15 */ |
| 15306 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15307 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15308 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15309 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15310 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15311 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15312 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15313 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15314 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15315 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15316 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15317 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15318 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15319 | |
| 15320 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15321 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15322 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15323 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15324 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15325 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15326 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15327 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15328 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15329 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15330 | |
| 15331 | { } |
| 15332 | }; |
| 15333 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15334 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15335 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15336 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15337 | { } |
| 15338 | }; |
| 15339 | |
| 15340 | /* toggle speaker-output according to the hp-jack state */ |
| 15341 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15342 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15343 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15344 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15345 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15346 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15347 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15348 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15349 | } |
| 15350 | |
| 15351 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15352 | unsigned int res) |
| 15353 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15354 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15355 | alc861_toshiba_automute(codec); |
| 15356 | } |
| 15357 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15358 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15359 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15360 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15361 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15362 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15363 | |
| 15364 | |
| 15365 | #define ALC861_DIGOUT_NID 0x07 |
| 15366 | |
| 15367 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15368 | { 8, NULL } |
| 15369 | }; |
| 15370 | |
| 15371 | static hda_nid_t alc861_dac_nids[4] = { |
| 15372 | /* front, surround, clfe, side */ |
| 15373 | 0x03, 0x06, 0x05, 0x04 |
| 15374 | }; |
| 15375 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15376 | static hda_nid_t alc660_dac_nids[3] = { |
| 15377 | /* front, clfe, surround */ |
| 15378 | 0x03, 0x05, 0x06 |
| 15379 | }; |
| 15380 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15381 | static hda_nid_t alc861_adc_nids[1] = { |
| 15382 | /* ADC0-2 */ |
| 15383 | 0x08, |
| 15384 | }; |
| 15385 | |
| 15386 | static struct hda_input_mux alc861_capture_source = { |
| 15387 | .num_items = 5, |
| 15388 | .items = { |
| 15389 | { "Mic", 0x0 }, |
| 15390 | { "Front Mic", 0x3 }, |
| 15391 | { "Line", 0x1 }, |
| 15392 | { "CD", 0x4 }, |
| 15393 | { "Mixer", 0x5 }, |
| 15394 | }, |
| 15395 | }; |
| 15396 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15397 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15398 | { |
| 15399 | struct alc_spec *spec = codec->spec; |
| 15400 | hda_nid_t mix, srcs[5]; |
| 15401 | int i, j, num; |
| 15402 | |
| 15403 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15404 | return 0; |
| 15405 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15406 | if (num < 0) |
| 15407 | return 0; |
| 15408 | for (i = 0; i < num; i++) { |
| 15409 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15410 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15411 | if (type != AC_WID_AUD_OUT) |
| 15412 | continue; |
| 15413 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15414 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15415 | break; |
| 15416 | if (j >= spec->multiout.num_dacs) |
| 15417 | return srcs[i]; |
| 15418 | } |
| 15419 | return 0; |
| 15420 | } |
| 15421 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15422 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15423 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15424 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15425 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15426 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15427 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15428 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15429 | |
| 15430 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15431 | for (i = 0; i < cfg->line_outs; i++) { |
| 15432 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15433 | dac = alc861_look_for_dac(codec, nid); |
| 15434 | if (!dac) |
| 15435 | continue; |
| 15436 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15437 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15438 | return 0; |
| 15439 | } |
| 15440 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15441 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15442 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15443 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15444 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15445 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15446 | } |
| 15447 | |
| 15448 | /* add playback controls from the parsed DAC table */ |
| 15449 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15450 | const struct auto_pin_cfg *cfg) |
| 15451 | { |
| 15452 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15453 | static const char *chname[4] = { |
| 15454 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15455 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15456 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15457 | int i, err; |
| 15458 | |
| 15459 | if (cfg->line_outs == 1) { |
| 15460 | const char *pfx = NULL; |
| 15461 | if (!cfg->hp_outs) |
| 15462 | pfx = "Master"; |
| 15463 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15464 | pfx = "Speaker"; |
| 15465 | if (pfx) { |
| 15466 | nid = spec->multiout.dac_nids[0]; |
| 15467 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 15468 | } |
| 15469 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15470 | |
| 15471 | for (i = 0; i < cfg->line_outs; i++) { |
| 15472 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15473 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15474 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15475 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15476 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15477 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15478 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15479 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15480 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15481 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15482 | return err; |
| 15483 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15484 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
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; |
| 15487 | } |
| 15488 | } |
| 15489 | return 0; |
| 15490 | } |
| 15491 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15492 | 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] | 15493 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15494 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15495 | int err; |
| 15496 | hda_nid_t nid; |
| 15497 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15498 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15499 | return 0; |
| 15500 | |
| 15501 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15502 | nid = alc861_look_for_dac(codec, pin); |
| 15503 | if (nid) { |
| 15504 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15505 | if (err < 0) |
| 15506 | return err; |
| 15507 | spec->multiout.hp_nid = nid; |
| 15508 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15509 | } |
| 15510 | return 0; |
| 15511 | } |
| 15512 | |
| 15513 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15514 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15515 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15516 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15517 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15518 | } |
| 15519 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15520 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15521 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15522 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15523 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15524 | hda_nid_t mix, srcs[5]; |
| 15525 | int i, num; |
| 15526 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15527 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15528 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15529 | 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] | 15530 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15531 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 15532 | return; |
| 15533 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15534 | if (num < 0) |
| 15535 | return; |
| 15536 | for (i = 0; i < num; i++) { |
| 15537 | unsigned int mute; |
| 15538 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 15539 | mute = AMP_IN_UNMUTE(i); |
| 15540 | else |
| 15541 | mute = AMP_IN_MUTE(i); |
| 15542 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15543 | mute); |
| 15544 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15545 | } |
| 15546 | |
| 15547 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 15548 | { |
| 15549 | struct alc_spec *spec = codec->spec; |
| 15550 | int i; |
| 15551 | |
| 15552 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 15553 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15554 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15555 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15556 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15557 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15558 | } |
| 15559 | } |
| 15560 | |
| 15561 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 15562 | { |
| 15563 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15564 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15565 | if (spec->autocfg.hp_outs) |
| 15566 | alc861_auto_set_output_and_unmute(codec, |
| 15567 | spec->autocfg.hp_pins[0], |
| 15568 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15569 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15570 | if (spec->autocfg.speaker_outs) |
| 15571 | alc861_auto_set_output_and_unmute(codec, |
| 15572 | spec->autocfg.speaker_pins[0], |
| 15573 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15574 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15575 | } |
| 15576 | |
| 15577 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 15578 | { |
| 15579 | struct alc_spec *spec = codec->spec; |
| 15580 | int i; |
| 15581 | |
| 15582 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15583 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15584 | if (nid >= 0x0c && nid <= 0x11) |
| 15585 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15586 | } |
| 15587 | } |
| 15588 | |
| 15589 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15590 | /* return 1 if successful, 0 if the proper config is not found, |
| 15591 | * or a negative error code |
| 15592 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15593 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 15594 | { |
| 15595 | struct alc_spec *spec = codec->spec; |
| 15596 | int err; |
| 15597 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 15598 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15599 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15600 | alc861_ignore); |
| 15601 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15602 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15603 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15604 | return 0; /* can't find valid BIOS pin config */ |
| 15605 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15606 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15607 | if (err < 0) |
| 15608 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15609 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15610 | if (err < 0) |
| 15611 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15612 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15613 | if (err < 0) |
| 15614 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15615 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15616 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15617 | return err; |
| 15618 | |
| 15619 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15620 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 15621 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15622 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15623 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15624 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15625 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15626 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15627 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 15628 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15629 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15630 | |
| 15631 | spec->adc_nids = alc861_adc_nids; |
| 15632 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15633 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15634 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 15635 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15636 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15637 | return 1; |
| 15638 | } |
| 15639 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15640 | /* additional initialization for auto-configuration model */ |
| 15641 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15642 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15643 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15644 | alc861_auto_init_multi_out(codec); |
| 15645 | alc861_auto_init_hp_out(codec); |
| 15646 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 15647 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15648 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15649 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15650 | } |
| 15651 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15652 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15653 | static struct hda_amp_list alc861_loopbacks[] = { |
| 15654 | { 0x15, HDA_INPUT, 0 }, |
| 15655 | { 0x15, HDA_INPUT, 1 }, |
| 15656 | { 0x15, HDA_INPUT, 2 }, |
| 15657 | { 0x15, HDA_INPUT, 3 }, |
| 15658 | { } /* end */ |
| 15659 | }; |
| 15660 | #endif |
| 15661 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15662 | |
| 15663 | /* |
| 15664 | * configuration and preset |
| 15665 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15666 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 15667 | [ALC861_3ST] = "3stack", |
| 15668 | [ALC660_3ST] = "3stack-660", |
| 15669 | [ALC861_3ST_DIG] = "3stack-dig", |
| 15670 | [ALC861_6ST_DIG] = "6stack-dig", |
| 15671 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 15672 | [ALC861_TOSHIBA] = "toshiba", |
| 15673 | [ALC861_ASUS] = "asus", |
| 15674 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 15675 | [ALC861_AUTO] = "auto", |
| 15676 | }; |
| 15677 | |
| 15678 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 15679 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15680 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15681 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15682 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15683 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 15684 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 15685 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 15686 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 15687 | * Any other models that need this preset? |
| 15688 | */ |
| 15689 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 15690 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 15691 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15692 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 15693 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 15694 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 15695 | /* FIXME: the below seems conflict */ |
| 15696 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 15697 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 15698 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15699 | {} |
| 15700 | }; |
| 15701 | |
| 15702 | static struct alc_config_preset alc861_presets[] = { |
| 15703 | [ALC861_3ST] = { |
| 15704 | .mixers = { alc861_3ST_mixer }, |
| 15705 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15706 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15707 | .dac_nids = alc861_dac_nids, |
| 15708 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15709 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15710 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15711 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15712 | .adc_nids = alc861_adc_nids, |
| 15713 | .input_mux = &alc861_capture_source, |
| 15714 | }, |
| 15715 | [ALC861_3ST_DIG] = { |
| 15716 | .mixers = { alc861_base_mixer }, |
| 15717 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15718 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15719 | .dac_nids = alc861_dac_nids, |
| 15720 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15721 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15722 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15723 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15724 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15725 | .adc_nids = alc861_adc_nids, |
| 15726 | .input_mux = &alc861_capture_source, |
| 15727 | }, |
| 15728 | [ALC861_6ST_DIG] = { |
| 15729 | .mixers = { alc861_base_mixer }, |
| 15730 | .init_verbs = { alc861_base_init_verbs }, |
| 15731 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15732 | .dac_nids = alc861_dac_nids, |
| 15733 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15734 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 15735 | .channel_mode = alc861_8ch_modes, |
| 15736 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15737 | .adc_nids = alc861_adc_nids, |
| 15738 | .input_mux = &alc861_capture_source, |
| 15739 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15740 | [ALC660_3ST] = { |
| 15741 | .mixers = { alc861_3ST_mixer }, |
| 15742 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15743 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 15744 | .dac_nids = alc660_dac_nids, |
| 15745 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15746 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15747 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15748 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15749 | .adc_nids = alc861_adc_nids, |
| 15750 | .input_mux = &alc861_capture_source, |
| 15751 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15752 | [ALC861_UNIWILL_M31] = { |
| 15753 | .mixers = { alc861_uniwill_m31_mixer }, |
| 15754 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 15755 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15756 | .dac_nids = alc861_dac_nids, |
| 15757 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15758 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15759 | .channel_mode = alc861_uniwill_m31_modes, |
| 15760 | .need_dac_fix = 1, |
| 15761 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15762 | .adc_nids = alc861_adc_nids, |
| 15763 | .input_mux = &alc861_capture_source, |
| 15764 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15765 | [ALC861_TOSHIBA] = { |
| 15766 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15767 | .init_verbs = { alc861_base_init_verbs, |
| 15768 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15769 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15770 | .dac_nids = alc861_dac_nids, |
| 15771 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15772 | .channel_mode = alc883_3ST_2ch_modes, |
| 15773 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15774 | .adc_nids = alc861_adc_nids, |
| 15775 | .input_mux = &alc861_capture_source, |
| 15776 | .unsol_event = alc861_toshiba_unsol_event, |
| 15777 | .init_hook = alc861_toshiba_automute, |
| 15778 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15779 | [ALC861_ASUS] = { |
| 15780 | .mixers = { alc861_asus_mixer }, |
| 15781 | .init_verbs = { alc861_asus_init_verbs }, |
| 15782 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15783 | .dac_nids = alc861_dac_nids, |
| 15784 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15785 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 15786 | .channel_mode = alc861_asus_modes, |
| 15787 | .need_dac_fix = 1, |
| 15788 | .hp_nid = 0x06, |
| 15789 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15790 | .adc_nids = alc861_adc_nids, |
| 15791 | .input_mux = &alc861_capture_source, |
| 15792 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15793 | [ALC861_ASUS_LAPTOP] = { |
| 15794 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 15795 | .init_verbs = { alc861_asus_init_verbs, |
| 15796 | alc861_asus_laptop_init_verbs }, |
| 15797 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15798 | .dac_nids = alc861_dac_nids, |
| 15799 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15800 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15801 | .channel_mode = alc883_3ST_2ch_modes, |
| 15802 | .need_dac_fix = 1, |
| 15803 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15804 | .adc_nids = alc861_adc_nids, |
| 15805 | .input_mux = &alc861_capture_source, |
| 15806 | }, |
| 15807 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15808 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15809 | /* Pin config fixes */ |
| 15810 | enum { |
| 15811 | PINFIX_FSC_AMILO_PI1505, |
| 15812 | }; |
| 15813 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15814 | static const struct alc_fixup alc861_fixups[] = { |
| 15815 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame^] | 15816 | .pins = (const struct alc_pincfg[]) { |
| 15817 | { 0x0b, 0x0221101f }, /* HP */ |
| 15818 | { 0x0f, 0x90170310 }, /* speaker */ |
| 15819 | { } |
| 15820 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15821 | }, |
| 15822 | }; |
| 15823 | |
| 15824 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 15825 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 15826 | {} |
| 15827 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15828 | |
| 15829 | static int patch_alc861(struct hda_codec *codec) |
| 15830 | { |
| 15831 | struct alc_spec *spec; |
| 15832 | int board_config; |
| 15833 | int err; |
| 15834 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 15835 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15836 | if (spec == NULL) |
| 15837 | return -ENOMEM; |
| 15838 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15839 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15840 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15841 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 15842 | alc861_models, |
| 15843 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15844 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15845 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15846 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15847 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15848 | board_config = ALC861_AUTO; |
| 15849 | } |
| 15850 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 15851 | if (board_config == ALC861_AUTO) |
| 15852 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15853 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15854 | if (board_config == ALC861_AUTO) { |
| 15855 | /* automatic parse from the BIOS config */ |
| 15856 | err = alc861_parse_auto_config(codec); |
| 15857 | if (err < 0) { |
| 15858 | alc_free(codec); |
| 15859 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15860 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15861 | printk(KERN_INFO |
| 15862 | "hda_codec: Cannot set up configuration " |
| 15863 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15864 | board_config = ALC861_3ST_DIG; |
| 15865 | } |
| 15866 | } |
| 15867 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15868 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15869 | if (err < 0) { |
| 15870 | alc_free(codec); |
| 15871 | return err; |
| 15872 | } |
| 15873 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15874 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15875 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15876 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15877 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 15878 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 15879 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15880 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 15881 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 15882 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 15883 | if (!spec->cap_mixer) |
| 15884 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15885 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 15886 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15887 | spec->vmaster_nid = 0x03; |
| 15888 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 15889 | if (board_config == ALC861_AUTO) |
| 15890 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); |
| 15891 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15892 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15893 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15894 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15895 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15896 | spec->power_hook = alc_power_eapd; |
| 15897 | #endif |
| 15898 | } |
| 15899 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15900 | if (!spec->loopback.amplist) |
| 15901 | spec->loopback.amplist = alc861_loopbacks; |
| 15902 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15903 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15904 | return 0; |
| 15905 | } |
| 15906 | |
| 15907 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15908 | * ALC861-VD support |
| 15909 | * |
| 15910 | * Based on ALC882 |
| 15911 | * |
| 15912 | * In addition, an independent DAC |
| 15913 | */ |
| 15914 | #define ALC861VD_DIGOUT_NID 0x06 |
| 15915 | |
| 15916 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 15917 | /* front, surr, clfe, side surr */ |
| 15918 | 0x02, 0x03, 0x04, 0x05 |
| 15919 | }; |
| 15920 | |
| 15921 | /* dac_nids for ALC660vd are in a different order - according to |
| 15922 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15923 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15924 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 15925 | * - and it is the same as in 861vd. |
| 15926 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 15927 | */ |
| 15928 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 15929 | /* front, rear, clfe, rear_surr */ |
| 15930 | 0x02, 0x04, 0x03 |
| 15931 | }; |
| 15932 | |
| 15933 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 15934 | /* ADC0 */ |
| 15935 | 0x09, |
| 15936 | }; |
| 15937 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15938 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 15939 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15940 | /* input MUX */ |
| 15941 | /* FIXME: should be a matrix-type input source selection */ |
| 15942 | static struct hda_input_mux alc861vd_capture_source = { |
| 15943 | .num_items = 4, |
| 15944 | .items = { |
| 15945 | { "Mic", 0x0 }, |
| 15946 | { "Front Mic", 0x1 }, |
| 15947 | { "Line", 0x2 }, |
| 15948 | { "CD", 0x4 }, |
| 15949 | }, |
| 15950 | }; |
| 15951 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15952 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15953 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15954 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15955 | { "Ext Mic", 0x0 }, |
| 15956 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15957 | }, |
| 15958 | }; |
| 15959 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15960 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 15961 | .num_items = 2, |
| 15962 | .items = { |
| 15963 | { "Front Mic", 0x0 }, |
| 15964 | { "ATAPI Mic", 0x1 }, |
| 15965 | }, |
| 15966 | }; |
| 15967 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15968 | /* |
| 15969 | * 2ch mode |
| 15970 | */ |
| 15971 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 15972 | { 2, NULL } |
| 15973 | }; |
| 15974 | |
| 15975 | /* |
| 15976 | * 6ch mode |
| 15977 | */ |
| 15978 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 15979 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15980 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15981 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15982 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15983 | { } /* end */ |
| 15984 | }; |
| 15985 | |
| 15986 | /* |
| 15987 | * 8ch mode |
| 15988 | */ |
| 15989 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 15990 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15991 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15992 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15993 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15994 | { } /* end */ |
| 15995 | }; |
| 15996 | |
| 15997 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 15998 | { 6, alc861vd_6stack_ch6_init }, |
| 15999 | { 8, alc861vd_6stack_ch8_init }, |
| 16000 | }; |
| 16001 | |
| 16002 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 16003 | { |
| 16004 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16005 | .name = "Channel Mode", |
| 16006 | .info = alc_ch_mode_info, |
| 16007 | .get = alc_ch_mode_get, |
| 16008 | .put = alc_ch_mode_put, |
| 16009 | }, |
| 16010 | { } /* end */ |
| 16011 | }; |
| 16012 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16013 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16014 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16015 | */ |
| 16016 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 16017 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16018 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16019 | |
| 16020 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16021 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16022 | |
| 16023 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16024 | HDA_OUTPUT), |
| 16025 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16026 | HDA_OUTPUT), |
| 16027 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16028 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16029 | |
| 16030 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16031 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16032 | |
| 16033 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16034 | |
| 16035 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16036 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16037 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16038 | |
| 16039 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16040 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16041 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16042 | |
| 16043 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16044 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16045 | |
| 16046 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16047 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16048 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16049 | { } /* end */ |
| 16050 | }; |
| 16051 | |
| 16052 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 16053 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16054 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16055 | |
| 16056 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16057 | |
| 16058 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16059 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16060 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16061 | |
| 16062 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16063 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16064 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16065 | |
| 16066 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16067 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16068 | |
| 16069 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16070 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16071 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16072 | { } /* end */ |
| 16073 | }; |
| 16074 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16075 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 16076 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16077 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16078 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16079 | |
| 16080 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16081 | |
| 16082 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 16083 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16084 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16085 | |
| 16086 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 16087 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16088 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16089 | |
| 16090 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16091 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16092 | |
| 16093 | { } /* end */ |
| 16094 | }; |
| 16095 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16096 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 16097 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16098 | */ |
| 16099 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16100 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16101 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16102 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16103 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16104 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16105 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16106 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16107 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16108 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16109 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16110 | { } /* end */ |
| 16111 | }; |
| 16112 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16113 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16114 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16115 | */ |
| 16116 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16117 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16118 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16119 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16120 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16121 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16122 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16123 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16124 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16125 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16126 | { } /* end */ |
| 16127 | }; |
| 16128 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16129 | /* |
| 16130 | * generic initialization of ADC, input mixers and output mixers |
| 16131 | */ |
| 16132 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16133 | /* |
| 16134 | * Unmute ADC0 and set the default input to mic-in |
| 16135 | */ |
| 16136 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16137 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16138 | |
| 16139 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16140 | * the analog-loopback mixer widget |
| 16141 | */ |
| 16142 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16143 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16144 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16145 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16146 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16147 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16148 | |
| 16149 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16150 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16151 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16152 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16153 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16154 | |
| 16155 | /* |
| 16156 | * Set up output mixers (0x02 - 0x05) |
| 16157 | */ |
| 16158 | /* set vol=0 to output mixers */ |
| 16159 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16160 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16161 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16162 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16163 | |
| 16164 | /* set up input amps for analog loopback */ |
| 16165 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16166 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16167 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16168 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16169 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16170 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16171 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16172 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16173 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16174 | |
| 16175 | { } |
| 16176 | }; |
| 16177 | |
| 16178 | /* |
| 16179 | * 3-stack pin configuration: |
| 16180 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16181 | */ |
| 16182 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16183 | /* |
| 16184 | * Set pin mode and muting |
| 16185 | */ |
| 16186 | /* set front pin widgets 0x14 for output */ |
| 16187 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16188 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16189 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16190 | |
| 16191 | /* Mic (rear) pin: input vref at 80% */ |
| 16192 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16193 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16194 | /* Front Mic pin: input vref at 80% */ |
| 16195 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16196 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16197 | /* Line In pin: input */ |
| 16198 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16199 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16200 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16201 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16202 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16203 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16204 | /* CD pin widget for input */ |
| 16205 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16206 | |
| 16207 | { } |
| 16208 | }; |
| 16209 | |
| 16210 | /* |
| 16211 | * 6-stack pin configuration: |
| 16212 | */ |
| 16213 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16214 | /* |
| 16215 | * Set pin mode and muting |
| 16216 | */ |
| 16217 | /* set front pin widgets 0x14 for output */ |
| 16218 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16219 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16220 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16221 | |
| 16222 | /* Rear Pin: output 1 (0x0d) */ |
| 16223 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16224 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16225 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16226 | /* CLFE Pin: output 2 (0x0e) */ |
| 16227 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16228 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16229 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16230 | /* Side Pin: output 3 (0x0f) */ |
| 16231 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16232 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16233 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16234 | |
| 16235 | /* Mic (rear) pin: input vref at 80% */ |
| 16236 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16237 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16238 | /* Front Mic pin: input vref at 80% */ |
| 16239 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16240 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16241 | /* Line In pin: input */ |
| 16242 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16243 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16244 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16245 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16246 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16247 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16248 | /* CD pin widget for input */ |
| 16249 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16250 | |
| 16251 | { } |
| 16252 | }; |
| 16253 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16254 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16255 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16256 | { } |
| 16257 | }; |
| 16258 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16259 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16260 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16261 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16262 | { } |
| 16263 | }; |
| 16264 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16265 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16266 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16267 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16268 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16269 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16270 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16271 | {} |
| 16272 | }; |
| 16273 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16274 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 16275 | { |
| 16276 | unsigned int present; |
| 16277 | unsigned char bits; |
| 16278 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16279 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16280 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16281 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16282 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 16283 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16284 | } |
| 16285 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16286 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16287 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16288 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16289 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16290 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16291 | } |
| 16292 | |
| 16293 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16294 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16295 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16296 | alc861vd_lenovo_mic_automute(codec); |
| 16297 | } |
| 16298 | |
| 16299 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16300 | unsigned int res) |
| 16301 | { |
| 16302 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16303 | case ALC880_MIC_EVENT: |
| 16304 | alc861vd_lenovo_mic_automute(codec); |
| 16305 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16306 | default: |
| 16307 | alc_automute_amp_unsol_event(codec, res); |
| 16308 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16309 | } |
| 16310 | } |
| 16311 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16312 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16313 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16314 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16315 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16316 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16317 | |
| 16318 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16319 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16320 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16321 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16322 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16323 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16324 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16325 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16326 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16327 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16328 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16329 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16330 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16331 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16332 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16333 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16334 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16335 | |
| 16336 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16337 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16338 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16339 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16340 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16341 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16342 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16343 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16344 | |
| 16345 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16346 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16347 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16348 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16349 | |
| 16350 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16351 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16352 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16353 | |
| 16354 | { } /* end */ |
| 16355 | }; |
| 16356 | |
| 16357 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16358 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16359 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16360 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16361 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16362 | spec->autocfg.hp_pins[0] = 0x15; |
| 16363 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16364 | } |
| 16365 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16366 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16367 | #define alc861vd_loopbacks alc880_loopbacks |
| 16368 | #endif |
| 16369 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16370 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16371 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16372 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16373 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16374 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16375 | |
| 16376 | /* |
| 16377 | * configuration and preset |
| 16378 | */ |
| 16379 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 16380 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16381 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16382 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16383 | [ALC861VD_3ST] = "3stack", |
| 16384 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16385 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16386 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16387 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16388 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16389 | [ALC861VD_AUTO] = "auto", |
| 16390 | }; |
| 16391 | |
| 16392 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16393 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16394 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16395 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16396 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16397 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16398 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16399 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16400 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16401 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16402 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16403 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16404 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16405 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16406 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16407 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16408 | {} |
| 16409 | }; |
| 16410 | |
| 16411 | static struct alc_config_preset alc861vd_presets[] = { |
| 16412 | [ALC660VD_3ST] = { |
| 16413 | .mixers = { alc861vd_3st_mixer }, |
| 16414 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16415 | alc861vd_3stack_init_verbs }, |
| 16416 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16417 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16418 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16419 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16420 | .input_mux = &alc861vd_capture_source, |
| 16421 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16422 | [ALC660VD_3ST_DIG] = { |
| 16423 | .mixers = { alc861vd_3st_mixer }, |
| 16424 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16425 | alc861vd_3stack_init_verbs }, |
| 16426 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16427 | .dac_nids = alc660vd_dac_nids, |
| 16428 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16429 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16430 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16431 | .input_mux = &alc861vd_capture_source, |
| 16432 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16433 | [ALC861VD_3ST] = { |
| 16434 | .mixers = { alc861vd_3st_mixer }, |
| 16435 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16436 | alc861vd_3stack_init_verbs }, |
| 16437 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16438 | .dac_nids = alc861vd_dac_nids, |
| 16439 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16440 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16441 | .input_mux = &alc861vd_capture_source, |
| 16442 | }, |
| 16443 | [ALC861VD_3ST_DIG] = { |
| 16444 | .mixers = { alc861vd_3st_mixer }, |
| 16445 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16446 | alc861vd_3stack_init_verbs }, |
| 16447 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16448 | .dac_nids = alc861vd_dac_nids, |
| 16449 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16450 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16451 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16452 | .input_mux = &alc861vd_capture_source, |
| 16453 | }, |
| 16454 | [ALC861VD_6ST_DIG] = { |
| 16455 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16456 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16457 | alc861vd_6stack_init_verbs }, |
| 16458 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16459 | .dac_nids = alc861vd_dac_nids, |
| 16460 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16461 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16462 | .channel_mode = alc861vd_6stack_modes, |
| 16463 | .input_mux = &alc861vd_capture_source, |
| 16464 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16465 | [ALC861VD_LENOVO] = { |
| 16466 | .mixers = { alc861vd_lenovo_mixer }, |
| 16467 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16468 | alc861vd_3stack_init_verbs, |
| 16469 | alc861vd_eapd_verbs, |
| 16470 | alc861vd_lenovo_unsol_verbs }, |
| 16471 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16472 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16473 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16474 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16475 | .input_mux = &alc861vd_capture_source, |
| 16476 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16477 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16478 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16479 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16480 | [ALC861VD_DALLAS] = { |
| 16481 | .mixers = { alc861vd_dallas_mixer }, |
| 16482 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16483 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16484 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16485 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16486 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16487 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16488 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16489 | .setup = alc861vd_dallas_setup, |
| 16490 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16491 | }, |
| 16492 | [ALC861VD_HP] = { |
| 16493 | .mixers = { alc861vd_hp_mixer }, |
| 16494 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16495 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16496 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16497 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16498 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16499 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16500 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16501 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16502 | .setup = alc861vd_dallas_setup, |
| 16503 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16504 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16505 | [ALC660VD_ASUS_V1S] = { |
| 16506 | .mixers = { alc861vd_lenovo_mixer }, |
| 16507 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16508 | alc861vd_3stack_init_verbs, |
| 16509 | alc861vd_eapd_verbs, |
| 16510 | alc861vd_lenovo_unsol_verbs }, |
| 16511 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16512 | .dac_nids = alc660vd_dac_nids, |
| 16513 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16514 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16515 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16516 | .input_mux = &alc861vd_capture_source, |
| 16517 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16518 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16519 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16520 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16521 | }; |
| 16522 | |
| 16523 | /* |
| 16524 | * BIOS auto configuration |
| 16525 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16526 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 16527 | const struct auto_pin_cfg *cfg) |
| 16528 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16529 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16530 | } |
| 16531 | |
| 16532 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16533 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16534 | hda_nid_t nid, int pin_type, int dac_idx) |
| 16535 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16536 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16537 | } |
| 16538 | |
| 16539 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 16540 | { |
| 16541 | struct alc_spec *spec = codec->spec; |
| 16542 | int i; |
| 16543 | |
| 16544 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16545 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16546 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16547 | if (nid) |
| 16548 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16549 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16550 | } |
| 16551 | } |
| 16552 | |
| 16553 | |
| 16554 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 16555 | { |
| 16556 | struct alc_spec *spec = codec->spec; |
| 16557 | hda_nid_t pin; |
| 16558 | |
| 16559 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16560 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16561 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16562 | pin = spec->autocfg.speaker_pins[0]; |
| 16563 | if (pin) |
| 16564 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16565 | } |
| 16566 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16567 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 16568 | |
| 16569 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 16570 | { |
| 16571 | struct alc_spec *spec = codec->spec; |
| 16572 | int i; |
| 16573 | |
| 16574 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16575 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16576 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16577 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 16578 | if (nid != ALC861VD_PIN_CD_NID && |
| 16579 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16580 | snd_hda_codec_write(codec, nid, 0, |
| 16581 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16582 | AMP_OUT_MUTE); |
| 16583 | } |
| 16584 | } |
| 16585 | } |
| 16586 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16587 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 16588 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16589 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 16590 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 16591 | |
| 16592 | /* add playback controls from the parsed DAC table */ |
| 16593 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16594 | * different NIDs for mute/unmute switch and volume control */ |
| 16595 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16596 | const struct auto_pin_cfg *cfg) |
| 16597 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16598 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 16599 | hda_nid_t nid_v, nid_s; |
| 16600 | int i, err; |
| 16601 | |
| 16602 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16603 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16604 | continue; |
| 16605 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16606 | alc880_dac_to_idx( |
| 16607 | spec->multiout.dac_nids[i])); |
| 16608 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16609 | alc880_dac_to_idx( |
| 16610 | spec->multiout.dac_nids[i])); |
| 16611 | |
| 16612 | if (i == 2) { |
| 16613 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16614 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16615 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16616 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 16617 | HDA_OUTPUT)); |
| 16618 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16619 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16620 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16621 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16622 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 16623 | HDA_OUTPUT)); |
| 16624 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16625 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16626 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16627 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16628 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 16629 | HDA_INPUT)); |
| 16630 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16631 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16632 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16633 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16634 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 16635 | HDA_INPUT)); |
| 16636 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16637 | return err; |
| 16638 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16639 | const char *pfx; |
| 16640 | if (cfg->line_outs == 1 && |
| 16641 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 16642 | if (!cfg->hp_pins) |
| 16643 | pfx = "Speaker"; |
| 16644 | else |
| 16645 | pfx = "PCM"; |
| 16646 | } else |
| 16647 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16648 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16649 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 16650 | HDA_OUTPUT)); |
| 16651 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16652 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16653 | if (cfg->line_outs == 1 && |
| 16654 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 16655 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16656 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16657 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16658 | HDA_INPUT)); |
| 16659 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16660 | return err; |
| 16661 | } |
| 16662 | } |
| 16663 | return 0; |
| 16664 | } |
| 16665 | |
| 16666 | /* add playback controls for speaker and HP outputs */ |
| 16667 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16668 | * different NIDs for mute/unmute switch and volume control */ |
| 16669 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 16670 | hda_nid_t pin, const char *pfx) |
| 16671 | { |
| 16672 | hda_nid_t nid_v, nid_s; |
| 16673 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16674 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16675 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16676 | return 0; |
| 16677 | |
| 16678 | if (alc880_is_fixed_pin(pin)) { |
| 16679 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16680 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16681 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16682 | spec->multiout.hp_nid = nid_v; |
| 16683 | else |
| 16684 | spec->multiout.extra_out_nid[0] = nid_v; |
| 16685 | /* control HP volume/switch on the output mixer amp */ |
| 16686 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16687 | alc880_fixed_pin_idx(pin)); |
| 16688 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16689 | alc880_fixed_pin_idx(pin)); |
| 16690 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16691 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16692 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 16693 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16694 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16695 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16696 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 16697 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16698 | return err; |
| 16699 | } else if (alc880_is_multi_pin(pin)) { |
| 16700 | /* set manual connection */ |
| 16701 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16702 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16703 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16704 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16705 | return err; |
| 16706 | } |
| 16707 | return 0; |
| 16708 | } |
| 16709 | |
| 16710 | /* parse the BIOS configuration and set up the alc_spec |
| 16711 | * return 1 if successful, 0 if the proper config is not found, |
| 16712 | * or a negative error code |
| 16713 | * Based on ALC880 version - had to change it to override |
| 16714 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 16715 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 16716 | { |
| 16717 | struct alc_spec *spec = codec->spec; |
| 16718 | int err; |
| 16719 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 16720 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16721 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16722 | alc861vd_ignore); |
| 16723 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16724 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16725 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16726 | return 0; /* can't find valid BIOS pin config */ |
| 16727 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16728 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16729 | if (err < 0) |
| 16730 | return err; |
| 16731 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16732 | if (err < 0) |
| 16733 | return err; |
| 16734 | err = alc861vd_auto_create_extra_out(spec, |
| 16735 | spec->autocfg.speaker_pins[0], |
| 16736 | "Speaker"); |
| 16737 | if (err < 0) |
| 16738 | return err; |
| 16739 | err = alc861vd_auto_create_extra_out(spec, |
| 16740 | spec->autocfg.hp_pins[0], |
| 16741 | "Headphone"); |
| 16742 | if (err < 0) |
| 16743 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16744 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16745 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16746 | return err; |
| 16747 | |
| 16748 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16749 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16750 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16751 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16752 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16753 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16754 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16755 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16756 | |
| 16757 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16758 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16759 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 16760 | err = alc_auto_add_mic_boost(codec); |
| 16761 | if (err < 0) |
| 16762 | return err; |
| 16763 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16764 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16765 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16766 | return 1; |
| 16767 | } |
| 16768 | |
| 16769 | /* additional initialization for auto-configuration model */ |
| 16770 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 16771 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16772 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16773 | alc861vd_auto_init_multi_out(codec); |
| 16774 | alc861vd_auto_init_hp_out(codec); |
| 16775 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16776 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16777 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16778 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16779 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16780 | } |
| 16781 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16782 | enum { |
| 16783 | ALC660VD_FIX_ASUS_GPIO1 |
| 16784 | }; |
| 16785 | |
| 16786 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16787 | static const struct alc_fixup alc861vd_fixups[] = { |
| 16788 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame^] | 16789 | .verbs = (const struct hda_verb[]) { |
| 16790 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 16791 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 16792 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 16793 | { } |
| 16794 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16795 | }, |
| 16796 | }; |
| 16797 | |
| 16798 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 16799 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 16800 | {} |
| 16801 | }; |
| 16802 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16803 | static int patch_alc861vd(struct hda_codec *codec) |
| 16804 | { |
| 16805 | struct alc_spec *spec; |
| 16806 | int err, board_config; |
| 16807 | |
| 16808 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16809 | if (spec == NULL) |
| 16810 | return -ENOMEM; |
| 16811 | |
| 16812 | codec->spec = spec; |
| 16813 | |
| 16814 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 16815 | alc861vd_models, |
| 16816 | alc861vd_cfg_tbl); |
| 16817 | |
| 16818 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16819 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16820 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16821 | board_config = ALC861VD_AUTO; |
| 16822 | } |
| 16823 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16824 | if (board_config == ALC861VD_AUTO) |
| 16825 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16826 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16827 | if (board_config == ALC861VD_AUTO) { |
| 16828 | /* automatic parse from the BIOS config */ |
| 16829 | err = alc861vd_parse_auto_config(codec); |
| 16830 | if (err < 0) { |
| 16831 | alc_free(codec); |
| 16832 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16833 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16834 | printk(KERN_INFO |
| 16835 | "hda_codec: Cannot set up configuration " |
| 16836 | "from BIOS. Using base mode...\n"); |
| 16837 | board_config = ALC861VD_3ST; |
| 16838 | } |
| 16839 | } |
| 16840 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16841 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16842 | if (err < 0) { |
| 16843 | alc_free(codec); |
| 16844 | return err; |
| 16845 | } |
| 16846 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16847 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16848 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16849 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16850 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16851 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16852 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16853 | } |
| 16854 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16855 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 16856 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 16857 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16858 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 16859 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 16860 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 16861 | if (!spec->adc_nids) { |
| 16862 | spec->adc_nids = alc861vd_adc_nids; |
| 16863 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 16864 | } |
| 16865 | if (!spec->capsrc_nids) |
| 16866 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16867 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16868 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16869 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16870 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16871 | spec->vmaster_nid = 0x02; |
| 16872 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16873 | if (board_config == ALC861VD_AUTO) |
| 16874 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); |
| 16875 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16876 | codec->patch_ops = alc_patch_ops; |
| 16877 | |
| 16878 | if (board_config == ALC861VD_AUTO) |
| 16879 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16880 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16881 | if (!spec->loopback.amplist) |
| 16882 | spec->loopback.amplist = alc861vd_loopbacks; |
| 16883 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16884 | |
| 16885 | return 0; |
| 16886 | } |
| 16887 | |
| 16888 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16889 | * ALC662 support |
| 16890 | * |
| 16891 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 16892 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 16893 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 16894 | * 6-channel independent captures. |
| 16895 | * |
| 16896 | * In addition, an independent DAC for the multi-playback (not used in this |
| 16897 | * driver yet). |
| 16898 | */ |
| 16899 | #define ALC662_DIGOUT_NID 0x06 |
| 16900 | #define ALC662_DIGIN_NID 0x0a |
| 16901 | |
| 16902 | static hda_nid_t alc662_dac_nids[4] = { |
| 16903 | /* front, rear, clfe, rear_surr */ |
| 16904 | 0x02, 0x03, 0x04 |
| 16905 | }; |
| 16906 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16907 | static hda_nid_t alc272_dac_nids[2] = { |
| 16908 | 0x02, 0x03 |
| 16909 | }; |
| 16910 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16911 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16912 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16913 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16914 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16915 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16916 | static hda_nid_t alc272_adc_nids[1] = { |
| 16917 | /* ADC1-2 */ |
| 16918 | 0x08, |
| 16919 | }; |
| 16920 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16921 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16922 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 16923 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16924 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16925 | /* input MUX */ |
| 16926 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16927 | static struct hda_input_mux alc662_capture_source = { |
| 16928 | .num_items = 4, |
| 16929 | .items = { |
| 16930 | { "Mic", 0x0 }, |
| 16931 | { "Front Mic", 0x1 }, |
| 16932 | { "Line", 0x2 }, |
| 16933 | { "CD", 0x4 }, |
| 16934 | }, |
| 16935 | }; |
| 16936 | |
| 16937 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 16938 | .num_items = 2, |
| 16939 | .items = { |
| 16940 | { "Mic", 0x1 }, |
| 16941 | { "Line", 0x2 }, |
| 16942 | }, |
| 16943 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16944 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16945 | static struct hda_input_mux alc663_capture_source = { |
| 16946 | .num_items = 3, |
| 16947 | .items = { |
| 16948 | { "Mic", 0x0 }, |
| 16949 | { "Front Mic", 0x1 }, |
| 16950 | { "Line", 0x2 }, |
| 16951 | }, |
| 16952 | }; |
| 16953 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16954 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16955 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 16956 | .num_items = 16, |
| 16957 | .items = { |
| 16958 | { "Autoselect Mic", 0x0 }, |
| 16959 | { "Internal Mic", 0x1 }, |
| 16960 | { "In-0x02", 0x2 }, |
| 16961 | { "In-0x03", 0x3 }, |
| 16962 | { "In-0x04", 0x4 }, |
| 16963 | { "In-0x05", 0x5 }, |
| 16964 | { "In-0x06", 0x6 }, |
| 16965 | { "In-0x07", 0x7 }, |
| 16966 | { "In-0x08", 0x8 }, |
| 16967 | { "In-0x09", 0x9 }, |
| 16968 | { "In-0x0a", 0x0a }, |
| 16969 | { "In-0x0b", 0x0b }, |
| 16970 | { "In-0x0c", 0x0c }, |
| 16971 | { "In-0x0d", 0x0d }, |
| 16972 | { "In-0x0e", 0x0e }, |
| 16973 | { "In-0x0f", 0x0f }, |
| 16974 | }, |
| 16975 | }; |
| 16976 | #endif |
| 16977 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16978 | /* |
| 16979 | * 2ch mode |
| 16980 | */ |
| 16981 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 16982 | { 2, NULL } |
| 16983 | }; |
| 16984 | |
| 16985 | /* |
| 16986 | * 2ch mode |
| 16987 | */ |
| 16988 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 16989 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 16990 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 16991 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 16992 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 16993 | { } /* end */ |
| 16994 | }; |
| 16995 | |
| 16996 | /* |
| 16997 | * 6ch mode |
| 16998 | */ |
| 16999 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 17000 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17001 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17002 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17003 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17004 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17005 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17006 | { } /* end */ |
| 17007 | }; |
| 17008 | |
| 17009 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 17010 | { 2, alc662_3ST_ch2_init }, |
| 17011 | { 6, alc662_3ST_ch6_init }, |
| 17012 | }; |
| 17013 | |
| 17014 | /* |
| 17015 | * 2ch mode |
| 17016 | */ |
| 17017 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 17018 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17019 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17020 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17021 | { } /* end */ |
| 17022 | }; |
| 17023 | |
| 17024 | /* |
| 17025 | * 6ch mode |
| 17026 | */ |
| 17027 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 17028 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17029 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17030 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17031 | { } /* end */ |
| 17032 | }; |
| 17033 | |
| 17034 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 17035 | { 2, alc662_sixstack_ch6_init }, |
| 17036 | { 6, alc662_sixstack_ch8_init }, |
| 17037 | }; |
| 17038 | |
| 17039 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17040 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17041 | */ |
| 17042 | |
| 17043 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 17044 | /* output mixer control */ |
| 17045 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17046 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17047 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17048 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17049 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17050 | 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] | 17051 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17052 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17053 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17054 | |
| 17055 | /*Input mixer control */ |
| 17056 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17057 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17058 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17059 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17060 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17061 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17062 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17063 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17064 | { } /* end */ |
| 17065 | }; |
| 17066 | |
| 17067 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 17068 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17069 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17070 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17071 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17072 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17073 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17074 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17075 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17076 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17077 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17078 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17079 | { } /* end */ |
| 17080 | }; |
| 17081 | |
| 17082 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 17083 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17084 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17085 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17086 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17087 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17088 | 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] | 17089 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17090 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17091 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17092 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17093 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17094 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17095 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17096 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17097 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17098 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17099 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17100 | { } /* end */ |
| 17101 | }; |
| 17102 | |
| 17103 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17104 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17105 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17106 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17107 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17108 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17109 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17110 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17111 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17112 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17113 | { } /* end */ |
| 17114 | }; |
| 17115 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17116 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17117 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17118 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17119 | |
| 17120 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 17121 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17122 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17123 | |
| 17124 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17125 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17126 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17127 | { } /* end */ |
| 17128 | }; |
| 17129 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17130 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17131 | ALC262_HIPPO_MASTER_SWITCH, |
| 17132 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17133 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17134 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17135 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17136 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17137 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17138 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17139 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17140 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17141 | { } /* end */ |
| 17142 | }; |
| 17143 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17144 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17145 | .ops = &snd_hda_bind_vol, |
| 17146 | .values = { |
| 17147 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17148 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17149 | 0 |
| 17150 | }, |
| 17151 | }; |
| 17152 | |
| 17153 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17154 | .ops = &snd_hda_bind_sw, |
| 17155 | .values = { |
| 17156 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17157 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17158 | 0 |
| 17159 | }, |
| 17160 | }; |
| 17161 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17162 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17163 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17164 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17165 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17166 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17167 | { } /* end */ |
| 17168 | }; |
| 17169 | |
| 17170 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17171 | .ops = &snd_hda_bind_sw, |
| 17172 | .values = { |
| 17173 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17174 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17175 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17176 | 0 |
| 17177 | }, |
| 17178 | }; |
| 17179 | |
| 17180 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17181 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17182 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17183 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17184 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17185 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17186 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17187 | |
| 17188 | { } /* end */ |
| 17189 | }; |
| 17190 | |
| 17191 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17192 | .ops = &snd_hda_bind_sw, |
| 17193 | .values = { |
| 17194 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17195 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17196 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17197 | 0 |
| 17198 | }, |
| 17199 | }; |
| 17200 | |
| 17201 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17202 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17203 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17204 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17205 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17206 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17207 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17208 | { } /* end */ |
| 17209 | }; |
| 17210 | |
| 17211 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17212 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17213 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17214 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 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 hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17223 | .ops = &snd_hda_bind_vol, |
| 17224 | .values = { |
| 17225 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17226 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17227 | 0 |
| 17228 | }, |
| 17229 | }; |
| 17230 | |
| 17231 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17232 | .ops = &snd_hda_bind_sw, |
| 17233 | .values = { |
| 17234 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17235 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17236 | 0 |
| 17237 | }, |
| 17238 | }; |
| 17239 | |
| 17240 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17241 | HDA_BIND_VOL("Master Playback Volume", |
| 17242 | &alc663_asus_two_bind_master_vol), |
| 17243 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17244 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17245 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17246 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17247 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17248 | { } /* end */ |
| 17249 | }; |
| 17250 | |
| 17251 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17252 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17253 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17254 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17255 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17256 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17257 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17258 | { } /* end */ |
| 17259 | }; |
| 17260 | |
| 17261 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17262 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17263 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17264 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17265 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17266 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17267 | |
| 17268 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17269 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17270 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17271 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17272 | { } /* end */ |
| 17273 | }; |
| 17274 | |
| 17275 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17276 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17277 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17278 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17279 | |
| 17280 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17281 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17282 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17283 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17284 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17285 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17286 | { } /* end */ |
| 17287 | }; |
| 17288 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17289 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17290 | .ops = &snd_hda_bind_sw, |
| 17291 | .values = { |
| 17292 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17293 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17294 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17295 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17296 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17297 | 0 |
| 17298 | }, |
| 17299 | }; |
| 17300 | |
| 17301 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17302 | .ops = &snd_hda_bind_sw, |
| 17303 | .values = { |
| 17304 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17305 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17306 | 0 |
| 17307 | }, |
| 17308 | }; |
| 17309 | |
| 17310 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17311 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17312 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17313 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17314 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17315 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17316 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17317 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17318 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17319 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17320 | { } /* end */ |
| 17321 | }; |
| 17322 | |
| 17323 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17324 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17325 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17326 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17327 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17328 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17329 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17330 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17331 | { } /* end */ |
| 17332 | }; |
| 17333 | |
| 17334 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17335 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17336 | { |
| 17337 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17338 | .name = "Channel Mode", |
| 17339 | .info = alc_ch_mode_info, |
| 17340 | .get = alc_ch_mode_get, |
| 17341 | .put = alc_ch_mode_put, |
| 17342 | }, |
| 17343 | { } /* end */ |
| 17344 | }; |
| 17345 | |
| 17346 | static struct hda_verb alc662_init_verbs[] = { |
| 17347 | /* ADC: mute amp left and right */ |
| 17348 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17349 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17350 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17351 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17352 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17353 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17354 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17355 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17356 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17357 | |
| 17358 | /* Front Pin: output 0 (0x0c) */ |
| 17359 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17360 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17361 | |
| 17362 | /* Rear Pin: output 1 (0x0d) */ |
| 17363 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17364 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17365 | |
| 17366 | /* CLFE Pin: output 2 (0x0e) */ |
| 17367 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17368 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17369 | |
| 17370 | /* Mic (rear) pin: input vref at 80% */ |
| 17371 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17372 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17373 | /* Front Mic pin: input vref at 80% */ |
| 17374 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17375 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17376 | /* Line In pin: input */ |
| 17377 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17378 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17379 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17380 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17381 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17382 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17383 | /* CD pin widget for input */ |
| 17384 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17385 | |
| 17386 | /* FIXME: use matrix-type input source selection */ |
| 17387 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17388 | /* Input mixer */ |
| 17389 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17390 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17391 | |
| 17392 | /* always trun on EAPD */ |
| 17393 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17394 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17395 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17396 | { } |
| 17397 | }; |
| 17398 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17399 | static struct hda_verb alc663_init_verbs[] = { |
| 17400 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17401 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17402 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17403 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17404 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17405 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17406 | { } |
| 17407 | }; |
| 17408 | |
| 17409 | static struct hda_verb alc272_init_verbs[] = { |
| 17410 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17411 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17412 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17413 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17414 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17415 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17416 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17417 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17418 | { } |
| 17419 | }; |
| 17420 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17421 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17422 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17423 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17424 | {} |
| 17425 | }; |
| 17426 | |
| 17427 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17428 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17429 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17430 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17431 | }; |
| 17432 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17433 | /* Set Unsolicited Event*/ |
| 17434 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17435 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17436 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17437 | {} |
| 17438 | }; |
| 17439 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17440 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17441 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17442 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17443 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17444 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17445 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17446 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17447 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17448 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17449 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17450 | {} |
| 17451 | }; |
| 17452 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17453 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17454 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17455 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 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(1)}, |
| 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 | |
| 17464 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17465 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17466 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17467 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17468 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17469 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17470 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17471 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17472 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17473 | {} |
| 17474 | }; |
| 17475 | |
| 17476 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17477 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17478 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17479 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* 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 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17484 | {} |
| 17485 | }; |
| 17486 | |
| 17487 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17488 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17489 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17490 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17491 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17492 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17493 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17494 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17495 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17496 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17497 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17498 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17499 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17500 | {} |
| 17501 | }; |
| 17502 | |
| 17503 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 17504 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17505 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17506 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17507 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17508 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17509 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17510 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17511 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17512 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17513 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17514 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17515 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17516 | {} |
| 17517 | }; |
| 17518 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17519 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 17520 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17521 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 17522 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 17523 | |
| 17524 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17525 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17526 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17527 | |
| 17528 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17529 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17530 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 17531 | {} |
| 17532 | }; |
| 17533 | |
| 17534 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 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 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17540 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17541 | {} |
| 17542 | }; |
| 17543 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17544 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 17545 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 17546 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17547 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17548 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17549 | {} |
| 17550 | }; |
| 17551 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17552 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 17553 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17554 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17555 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17556 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17557 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17558 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17559 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17560 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17561 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17562 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17563 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17564 | {} |
| 17565 | }; |
| 17566 | |
| 17567 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 17568 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17569 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17570 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17571 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17572 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17573 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17574 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17575 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17576 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17577 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17578 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17579 | {} |
| 17580 | }; |
| 17581 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17582 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 17583 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17584 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17585 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17586 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17587 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17588 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17589 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17590 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17591 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17592 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17593 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17594 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17595 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17596 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17597 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17598 | {} |
| 17599 | }; |
| 17600 | |
| 17601 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 17602 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17603 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17604 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17605 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17606 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17607 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17608 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17609 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17610 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17611 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17612 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17613 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17614 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17615 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17616 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17617 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17618 | {} |
| 17619 | }; |
| 17620 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17621 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 17622 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 17623 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 17624 | { } /* end */ |
| 17625 | }; |
| 17626 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17627 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 17628 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 17629 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 17630 | { } /* end */ |
| 17631 | }; |
| 17632 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17633 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 17634 | { |
| 17635 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17636 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17637 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17638 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17639 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17640 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17641 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17642 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17643 | } |
| 17644 | |
| 17645 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 17646 | { |
| 17647 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17648 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17649 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17650 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17651 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17652 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17653 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17654 | HDA_AMP_MUTE, bits); |
| 17655 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17656 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17657 | } |
| 17658 | |
| 17659 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 17660 | unsigned int res) |
| 17661 | { |
| 17662 | if ((res >> 26) == ALC880_HP_EVENT) |
| 17663 | alc662_lenovo_101e_all_automute(codec); |
| 17664 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 17665 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 17666 | } |
| 17667 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17668 | /* unsolicited event for HP jack sensing */ |
| 17669 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 17670 | unsigned int res) |
| 17671 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17672 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17673 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17674 | else |
| 17675 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17676 | } |
| 17677 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17678 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17679 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17680 | struct alc_spec *spec = codec->spec; |
| 17681 | |
| 17682 | alc262_hippo1_setup(codec); |
| 17683 | spec->ext_mic.pin = 0x18; |
| 17684 | spec->ext_mic.mux_idx = 0; |
| 17685 | spec->int_mic.pin = 0x19; |
| 17686 | spec->int_mic.mux_idx = 1; |
| 17687 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17688 | } |
| 17689 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17690 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 17691 | { |
| 17692 | alc262_hippo_automute(codec); |
| 17693 | alc_mic_automute(codec); |
| 17694 | } |
| 17695 | |
| 17696 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17697 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17698 | struct alc_spec *spec = codec->spec; |
| 17699 | |
| 17700 | spec->autocfg.hp_pins[0] = 0x14; |
| 17701 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17702 | } |
| 17703 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17704 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 17705 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17706 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 17707 | { |
| 17708 | unsigned int present; |
| 17709 | unsigned char bits; |
| 17710 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17711 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17712 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17713 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17714 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17715 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17716 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17717 | } |
| 17718 | |
| 17719 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 17720 | { |
| 17721 | unsigned int present; |
| 17722 | unsigned char bits; |
| 17723 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17724 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17725 | bits = present ? HDA_AMP_MUTE : 0; |
| 17726 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
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 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17729 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17730 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17731 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17732 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17733 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17734 | } |
| 17735 | |
| 17736 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 17737 | { |
| 17738 | unsigned int present; |
| 17739 | unsigned char bits; |
| 17740 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17741 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17742 | bits = present ? HDA_AMP_MUTE : 0; |
| 17743 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
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 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17746 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17747 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17748 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17749 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17750 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17751 | } |
| 17752 | |
| 17753 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 17754 | { |
| 17755 | unsigned int present; |
| 17756 | unsigned char bits; |
| 17757 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17758 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17759 | bits = present ? 0 : PIN_OUT; |
| 17760 | snd_hda_codec_write(codec, 0x14, 0, |
| 17761 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 17762 | } |
| 17763 | |
| 17764 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 17765 | { |
| 17766 | unsigned int present1, present2; |
| 17767 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17768 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 17769 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17770 | |
| 17771 | if (present1 || present2) { |
| 17772 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17773 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17774 | } else { |
| 17775 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17776 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17777 | } |
| 17778 | } |
| 17779 | |
| 17780 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 17781 | { |
| 17782 | unsigned int present1, present2; |
| 17783 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17784 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 17785 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17786 | |
| 17787 | if (present1 || present2) { |
| 17788 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17789 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17790 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17791 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17792 | } else { |
| 17793 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17794 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17795 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17796 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17797 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17798 | } |
| 17799 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17800 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 17801 | { |
| 17802 | unsigned int present1, present2; |
| 17803 | |
| 17804 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 17805 | AC_VERB_GET_PIN_SENSE, 0) |
| 17806 | & AC_PINSENSE_PRESENCE; |
| 17807 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 17808 | AC_VERB_GET_PIN_SENSE, 0) |
| 17809 | & AC_PINSENSE_PRESENCE; |
| 17810 | |
| 17811 | if (present1 || present2) { |
| 17812 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17813 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17814 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17815 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17816 | } else { |
| 17817 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17818 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17819 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17820 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17821 | } |
| 17822 | } |
| 17823 | |
| 17824 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 17825 | { |
| 17826 | unsigned int present1, present2; |
| 17827 | |
| 17828 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 17829 | AC_VERB_GET_PIN_SENSE, 0) |
| 17830 | & AC_PINSENSE_PRESENCE; |
| 17831 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 17832 | AC_VERB_GET_PIN_SENSE, 0) |
| 17833 | & AC_PINSENSE_PRESENCE; |
| 17834 | |
| 17835 | if (present1 || present2) { |
| 17836 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17837 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17838 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17839 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17840 | } else { |
| 17841 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17842 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17843 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17844 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17845 | } |
| 17846 | } |
| 17847 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17848 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 17849 | unsigned int res) |
| 17850 | { |
| 17851 | switch (res >> 26) { |
| 17852 | case ALC880_HP_EVENT: |
| 17853 | alc663_m51va_speaker_automute(codec); |
| 17854 | break; |
| 17855 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17856 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17857 | break; |
| 17858 | } |
| 17859 | } |
| 17860 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17861 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 17862 | { |
| 17863 | struct alc_spec *spec = codec->spec; |
| 17864 | spec->ext_mic.pin = 0x18; |
| 17865 | spec->ext_mic.mux_idx = 0; |
| 17866 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17867 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17868 | spec->auto_mic = 1; |
| 17869 | } |
| 17870 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17871 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 17872 | { |
| 17873 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17874 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17875 | } |
| 17876 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17877 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17878 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17879 | |
| 17880 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 17881 | { |
| 17882 | struct alc_spec *spec = codec->spec; |
| 17883 | spec->ext_mic.pin = 0x18; |
| 17884 | spec->ext_mic.mux_idx = 0; |
| 17885 | spec->int_mic.pin = 0x19; |
| 17886 | spec->int_mic.mux_idx = 1; |
| 17887 | spec->auto_mic = 1; |
| 17888 | } |
| 17889 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17890 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17891 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17892 | /* ***************** Mode2 ******************************/ |
| 17893 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 17894 | unsigned int res) |
| 17895 | { |
| 17896 | switch (res >> 26) { |
| 17897 | case ALC880_HP_EVENT: |
| 17898 | alc662_f5z_speaker_automute(codec); |
| 17899 | break; |
| 17900 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17901 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17902 | break; |
| 17903 | } |
| 17904 | } |
| 17905 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17906 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17907 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17908 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 17909 | { |
| 17910 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17911 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17912 | } |
| 17913 | /* ***************** Mode3 ******************************/ |
| 17914 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 17915 | unsigned int res) |
| 17916 | { |
| 17917 | switch (res >> 26) { |
| 17918 | case ALC880_HP_EVENT: |
| 17919 | alc663_two_hp_m1_speaker_automute(codec); |
| 17920 | break; |
| 17921 | case ALC880_MIC_EVENT: |
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 | break; |
| 17924 | } |
| 17925 | } |
| 17926 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17927 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17928 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17929 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 17930 | { |
| 17931 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17932 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17933 | } |
| 17934 | /* ***************** Mode4 ******************************/ |
| 17935 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 17936 | unsigned int res) |
| 17937 | { |
| 17938 | switch (res >> 26) { |
| 17939 | case ALC880_HP_EVENT: |
| 17940 | alc663_21jd_two_speaker_automute(codec); |
| 17941 | break; |
| 17942 | case ALC880_MIC_EVENT: |
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 | break; |
| 17945 | } |
| 17946 | } |
| 17947 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17948 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17949 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17950 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 17951 | { |
| 17952 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17953 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17954 | } |
| 17955 | /* ***************** Mode5 ******************************/ |
| 17956 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 17957 | unsigned int res) |
| 17958 | { |
| 17959 | switch (res >> 26) { |
| 17960 | case ALC880_HP_EVENT: |
| 17961 | alc663_15jd_two_speaker_automute(codec); |
| 17962 | break; |
| 17963 | case ALC880_MIC_EVENT: |
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 | break; |
| 17966 | } |
| 17967 | } |
| 17968 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17969 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17970 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17971 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 17972 | { |
| 17973 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17974 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17975 | } |
| 17976 | /* ***************** Mode6 ******************************/ |
| 17977 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 17978 | unsigned int res) |
| 17979 | { |
| 17980 | switch (res >> 26) { |
| 17981 | case ALC880_HP_EVENT: |
| 17982 | alc663_two_hp_m2_speaker_automute(codec); |
| 17983 | break; |
| 17984 | case ALC880_MIC_EVENT: |
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 | break; |
| 17987 | } |
| 17988 | } |
| 17989 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17990 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17991 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17992 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 17993 | { |
| 17994 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17995 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17996 | } |
| 17997 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17998 | /* ***************** Mode7 ******************************/ |
| 17999 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 18000 | unsigned int res) |
| 18001 | { |
| 18002 | switch (res >> 26) { |
| 18003 | case ALC880_HP_EVENT: |
| 18004 | alc663_two_hp_m7_speaker_automute(codec); |
| 18005 | break; |
| 18006 | case ALC880_MIC_EVENT: |
| 18007 | alc_mic_automute(codec); |
| 18008 | break; |
| 18009 | } |
| 18010 | } |
| 18011 | |
| 18012 | #define alc663_mode7_setup alc663_mode1_setup |
| 18013 | |
| 18014 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 18015 | { |
| 18016 | alc663_two_hp_m7_speaker_automute(codec); |
| 18017 | alc_mic_automute(codec); |
| 18018 | } |
| 18019 | |
| 18020 | /* ***************** Mode8 ******************************/ |
| 18021 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 18022 | unsigned int res) |
| 18023 | { |
| 18024 | switch (res >> 26) { |
| 18025 | case ALC880_HP_EVENT: |
| 18026 | alc663_two_hp_m8_speaker_automute(codec); |
| 18027 | break; |
| 18028 | case ALC880_MIC_EVENT: |
| 18029 | alc_mic_automute(codec); |
| 18030 | break; |
| 18031 | } |
| 18032 | } |
| 18033 | |
| 18034 | #define alc663_mode8_setup alc663_m51va_setup |
| 18035 | |
| 18036 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 18037 | { |
| 18038 | alc663_two_hp_m8_speaker_automute(codec); |
| 18039 | alc_mic_automute(codec); |
| 18040 | } |
| 18041 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18042 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 18043 | { |
| 18044 | unsigned int present; |
| 18045 | unsigned char bits; |
| 18046 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18047 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18048 | bits = present ? HDA_AMP_MUTE : 0; |
| 18049 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 18050 | HDA_AMP_MUTE, bits); |
| 18051 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18052 | HDA_AMP_MUTE, bits); |
| 18053 | } |
| 18054 | |
| 18055 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 18056 | { |
| 18057 | unsigned int present; |
| 18058 | unsigned char bits; |
| 18059 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 18060 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18061 | bits = present ? HDA_AMP_MUTE : 0; |
| 18062 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 18063 | HDA_AMP_MUTE, bits); |
| 18064 | } |
| 18065 | |
| 18066 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 18067 | unsigned int res) |
| 18068 | { |
| 18069 | switch (res >> 26) { |
| 18070 | case ALC880_HP_EVENT: |
| 18071 | alc663_g71v_hp_automute(codec); |
| 18072 | break; |
| 18073 | case ALC880_FRONT_EVENT: |
| 18074 | alc663_g71v_front_automute(codec); |
| 18075 | break; |
| 18076 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18077 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18078 | break; |
| 18079 | } |
| 18080 | } |
| 18081 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18082 | #define alc663_g71v_setup alc663_m51va_setup |
| 18083 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18084 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 18085 | { |
| 18086 | alc663_g71v_front_automute(codec); |
| 18087 | alc663_g71v_hp_automute(codec); |
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 | } |
| 18090 | |
| 18091 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 18092 | unsigned int res) |
| 18093 | { |
| 18094 | switch (res >> 26) { |
| 18095 | case ALC880_HP_EVENT: |
| 18096 | alc663_m51va_speaker_automute(codec); |
| 18097 | break; |
| 18098 | case ALC880_MIC_EVENT: |
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 | break; |
| 18101 | } |
| 18102 | } |
| 18103 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18104 | #define alc663_g50v_setup alc663_m51va_setup |
| 18105 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18106 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 18107 | { |
| 18108 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18109 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18110 | } |
| 18111 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18112 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18113 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18114 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18115 | |
| 18116 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 18117 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18118 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18119 | |
| 18120 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 18121 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18122 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18123 | { } /* end */ |
| 18124 | }; |
| 18125 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18126 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18127 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18128 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18129 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18130 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18131 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18132 | |
| 18133 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18134 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18135 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 18136 | |
| 18137 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18138 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18139 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 18140 | { } /* end */ |
| 18141 | }; |
| 18142 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18143 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18144 | #define alc662_loopbacks alc880_loopbacks |
| 18145 | #endif |
| 18146 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18147 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18148 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18149 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18150 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18151 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18152 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18153 | |
| 18154 | /* |
| 18155 | * configuration and preset |
| 18156 | */ |
| 18157 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 18158 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18159 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18160 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 18161 | [ALC662_5ST_DIG] = "6stack-dig", |
| 18162 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18163 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18164 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18165 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18166 | [ALC663_ASUS_M51VA] = "m51va", |
| 18167 | [ALC663_ASUS_G71V] = "g71v", |
| 18168 | [ALC663_ASUS_H13] = "h13", |
| 18169 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18170 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18171 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18172 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18173 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18174 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18175 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18176 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18177 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18178 | [ALC272_DELL] = "dell", |
| 18179 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18180 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18181 | [ALC662_AUTO] = "auto", |
| 18182 | }; |
| 18183 | |
| 18184 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18185 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18186 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18187 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18188 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18189 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18190 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18191 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18192 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18193 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18194 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18195 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18196 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18197 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18198 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18199 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18200 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18201 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18202 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18203 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18204 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18205 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18206 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18207 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18208 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18209 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18210 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18211 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18212 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18213 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18214 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18215 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18216 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18217 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18218 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18219 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18220 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18221 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18222 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18223 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18224 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18225 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18226 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18227 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18228 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18229 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18230 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18231 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18232 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18233 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18234 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18235 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18236 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18237 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18238 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18239 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18240 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18241 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18242 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18243 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18244 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18245 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18246 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18247 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18248 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18249 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18250 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18251 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 18252 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18253 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18254 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18255 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18256 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18257 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18258 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18259 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18260 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18261 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18262 | {} |
| 18263 | }; |
| 18264 | |
| 18265 | static struct alc_config_preset alc662_presets[] = { |
| 18266 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18267 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18268 | .init_verbs = { alc662_init_verbs }, |
| 18269 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18270 | .dac_nids = alc662_dac_nids, |
| 18271 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18272 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18273 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18274 | .channel_mode = alc662_3ST_2ch_modes, |
| 18275 | .input_mux = &alc662_capture_source, |
| 18276 | }, |
| 18277 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18278 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_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_6ch_modes), |
| 18285 | .channel_mode = alc662_3ST_6ch_modes, |
| 18286 | .need_dac_fix = 1, |
| 18287 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18288 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18289 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18290 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18291 | .init_verbs = { alc662_init_verbs }, |
| 18292 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18293 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18294 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18295 | .channel_mode = alc662_3ST_6ch_modes, |
| 18296 | .need_dac_fix = 1, |
| 18297 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18298 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18299 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18300 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18301 | .init_verbs = { alc662_init_verbs }, |
| 18302 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18303 | .dac_nids = alc662_dac_nids, |
| 18304 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18305 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18306 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18307 | .channel_mode = alc662_5stack_modes, |
| 18308 | .input_mux = &alc662_capture_source, |
| 18309 | }, |
| 18310 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18311 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18312 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18313 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18314 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18315 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18316 | .channel_mode = alc662_3ST_2ch_modes, |
| 18317 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18318 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18319 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18320 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18321 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18322 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18323 | .init_verbs = { alc662_init_verbs, |
| 18324 | alc662_eeepc_sue_init_verbs }, |
| 18325 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18326 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18327 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18328 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18329 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18330 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18331 | .init_hook = alc662_eeepc_inithook, |
| 18332 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18333 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18334 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18335 | alc662_chmode_mixer }, |
| 18336 | .init_verbs = { alc662_init_verbs, |
| 18337 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18338 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18339 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18340 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18341 | .channel_mode = alc662_3ST_6ch_modes, |
| 18342 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18343 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18344 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18345 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18346 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18347 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18348 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18349 | .init_verbs = { alc662_init_verbs, |
| 18350 | alc662_ecs_init_verbs }, |
| 18351 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18352 | .dac_nids = alc662_dac_nids, |
| 18353 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18354 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18355 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18356 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18357 | .init_hook = alc662_eeepc_inithook, |
| 18358 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18359 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18360 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18361 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18362 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18363 | .dac_nids = alc662_dac_nids, |
| 18364 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18365 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18366 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18367 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18368 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18369 | .init_hook = alc663_m51va_inithook, |
| 18370 | }, |
| 18371 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18372 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18373 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 18374 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18375 | .dac_nids = alc662_dac_nids, |
| 18376 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18377 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18378 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18379 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18380 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18381 | .init_hook = alc663_g71v_inithook, |
| 18382 | }, |
| 18383 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18384 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18385 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18386 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18387 | .dac_nids = alc662_dac_nids, |
| 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_m51va_unsol_event, |
| 18391 | .init_hook = alc663_m51va_inithook, |
| 18392 | }, |
| 18393 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18394 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18395 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18396 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18397 | .dac_nids = alc662_dac_nids, |
| 18398 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18399 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18400 | .channel_mode = alc662_3ST_6ch_modes, |
| 18401 | .input_mux = &alc663_capture_source, |
| 18402 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18403 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18404 | .init_hook = alc663_g50v_inithook, |
| 18405 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18406 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18407 | .mixers = { alc663_m51va_mixer }, |
| 18408 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18409 | .init_verbs = { alc662_init_verbs, |
| 18410 | alc663_21jd_amic_init_verbs }, |
| 18411 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18412 | .hp_nid = 0x03, |
| 18413 | .dac_nids = alc662_dac_nids, |
| 18414 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18415 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18416 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18417 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18418 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18419 | .init_hook = alc663_mode1_inithook, |
| 18420 | }, |
| 18421 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18422 | .mixers = { alc662_1bjd_mixer }, |
| 18423 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18424 | .init_verbs = { alc662_init_verbs, |
| 18425 | alc662_1bjd_amic_init_verbs }, |
| 18426 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18427 | .dac_nids = alc662_dac_nids, |
| 18428 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18429 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18430 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18431 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18432 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18433 | .init_hook = alc662_mode2_inithook, |
| 18434 | }, |
| 18435 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18436 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18437 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18438 | .init_verbs = { alc662_init_verbs, |
| 18439 | alc663_two_hp_amic_m1_init_verbs }, |
| 18440 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18441 | .hp_nid = 0x03, |
| 18442 | .dac_nids = alc662_dac_nids, |
| 18443 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18444 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18445 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18446 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18447 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18448 | .init_hook = alc663_mode3_inithook, |
| 18449 | }, |
| 18450 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18451 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18452 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18453 | .init_verbs = { alc662_init_verbs, |
| 18454 | alc663_21jd_amic_init_verbs}, |
| 18455 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18456 | .hp_nid = 0x03, |
| 18457 | .dac_nids = alc662_dac_nids, |
| 18458 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18459 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18460 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18461 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18462 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18463 | .init_hook = alc663_mode4_inithook, |
| 18464 | }, |
| 18465 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18466 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18467 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18468 | .init_verbs = { alc662_init_verbs, |
| 18469 | alc663_15jd_amic_init_verbs }, |
| 18470 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18471 | .hp_nid = 0x03, |
| 18472 | .dac_nids = alc662_dac_nids, |
| 18473 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18474 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18475 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18476 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18477 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18478 | .init_hook = alc663_mode5_inithook, |
| 18479 | }, |
| 18480 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18481 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18482 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18483 | .init_verbs = { alc662_init_verbs, |
| 18484 | alc663_two_hp_amic_m2_init_verbs }, |
| 18485 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18486 | .hp_nid = 0x03, |
| 18487 | .dac_nids = alc662_dac_nids, |
| 18488 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18489 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18490 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18491 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18492 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18493 | .init_hook = alc663_mode6_inithook, |
| 18494 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18495 | [ALC663_ASUS_MODE7] = { |
| 18496 | .mixers = { alc663_mode7_mixer }, |
| 18497 | .cap_mixer = alc662_auto_capture_mixer, |
| 18498 | .init_verbs = { alc662_init_verbs, |
| 18499 | alc663_mode7_init_verbs }, |
| 18500 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18501 | .hp_nid = 0x03, |
| 18502 | .dac_nids = alc662_dac_nids, |
| 18503 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18504 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18505 | .channel_mode = alc662_3ST_2ch_modes, |
| 18506 | .unsol_event = alc663_mode7_unsol_event, |
| 18507 | .setup = alc663_mode7_setup, |
| 18508 | .init_hook = alc663_mode7_inithook, |
| 18509 | }, |
| 18510 | [ALC663_ASUS_MODE8] = { |
| 18511 | .mixers = { alc663_mode8_mixer }, |
| 18512 | .cap_mixer = alc662_auto_capture_mixer, |
| 18513 | .init_verbs = { alc662_init_verbs, |
| 18514 | alc663_mode8_init_verbs }, |
| 18515 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18516 | .hp_nid = 0x03, |
| 18517 | .dac_nids = alc662_dac_nids, |
| 18518 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18519 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18520 | .channel_mode = alc662_3ST_2ch_modes, |
| 18521 | .unsol_event = alc663_mode8_unsol_event, |
| 18522 | .setup = alc663_mode8_setup, |
| 18523 | .init_hook = alc663_mode8_inithook, |
| 18524 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18525 | [ALC272_DELL] = { |
| 18526 | .mixers = { alc663_m51va_mixer }, |
| 18527 | .cap_mixer = alc272_auto_capture_mixer, |
| 18528 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 18529 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18530 | .dac_nids = alc662_dac_nids, |
| 18531 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18532 | .adc_nids = alc272_adc_nids, |
| 18533 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18534 | .capsrc_nids = alc272_capsrc_nids, |
| 18535 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18536 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18537 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18538 | .init_hook = alc663_m51va_inithook, |
| 18539 | }, |
| 18540 | [ALC272_DELL_ZM1] = { |
| 18541 | .mixers = { alc663_m51va_mixer }, |
| 18542 | .cap_mixer = alc662_auto_capture_mixer, |
| 18543 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 18544 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18545 | .dac_nids = alc662_dac_nids, |
| 18546 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18547 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18548 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18549 | .capsrc_nids = alc662_capsrc_nids, |
| 18550 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18551 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18552 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18553 | .init_hook = alc663_m51va_inithook, |
| 18554 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18555 | [ALC272_SAMSUNG_NC10] = { |
| 18556 | .mixers = { alc272_nc10_mixer }, |
| 18557 | .init_verbs = { alc662_init_verbs, |
| 18558 | alc663_21jd_amic_init_verbs }, |
| 18559 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18560 | .dac_nids = alc272_dac_nids, |
| 18561 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18562 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18563 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18564 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18565 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18566 | .init_hook = alc663_mode4_inithook, |
| 18567 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18568 | }; |
| 18569 | |
| 18570 | |
| 18571 | /* |
| 18572 | * BIOS auto configuration |
| 18573 | */ |
| 18574 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18575 | /* convert from MIX nid to DAC */ |
| 18576 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 18577 | { |
| 18578 | if (nid == 0x0f) |
| 18579 | return 0x02; |
| 18580 | else if (nid >= 0x0c && nid <= 0x0e) |
| 18581 | return nid - 0x0c + 0x02; |
| 18582 | else |
| 18583 | return 0; |
| 18584 | } |
| 18585 | |
| 18586 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 18587 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 18588 | hda_nid_t dac) |
| 18589 | { |
| 18590 | hda_nid_t mix[4]; |
| 18591 | int i, num; |
| 18592 | |
| 18593 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18594 | for (i = 0; i < num; i++) { |
| 18595 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 18596 | return mix[i]; |
| 18597 | } |
| 18598 | return 0; |
| 18599 | } |
| 18600 | |
| 18601 | /* look for an empty DAC slot */ |
| 18602 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 18603 | { |
| 18604 | struct alc_spec *spec = codec->spec; |
| 18605 | hda_nid_t srcs[5]; |
| 18606 | int i, j, num; |
| 18607 | |
| 18608 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 18609 | if (num < 0) |
| 18610 | return 0; |
| 18611 | for (i = 0; i < num; i++) { |
| 18612 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 18613 | if (!nid) |
| 18614 | continue; |
| 18615 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 18616 | if (spec->multiout.dac_nids[j] == nid) |
| 18617 | break; |
| 18618 | if (j >= spec->multiout.num_dacs) |
| 18619 | return nid; |
| 18620 | } |
| 18621 | return 0; |
| 18622 | } |
| 18623 | |
| 18624 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 18625 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 18626 | const struct auto_pin_cfg *cfg) |
| 18627 | { |
| 18628 | struct alc_spec *spec = codec->spec; |
| 18629 | int i; |
| 18630 | hda_nid_t dac; |
| 18631 | |
| 18632 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 18633 | for (i = 0; i < cfg->line_outs; i++) { |
| 18634 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 18635 | if (!dac) |
| 18636 | continue; |
| 18637 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 18638 | } |
| 18639 | return 0; |
| 18640 | } |
| 18641 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18642 | 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] | 18643 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18644 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18645 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18646 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 18647 | } |
| 18648 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18649 | 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] | 18650 | hda_nid_t nid, unsigned int chs) |
| 18651 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18652 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18653 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 18654 | } |
| 18655 | |
| 18656 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 18657 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 18658 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 18659 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 18660 | |
| 18661 | /* add playback controls from the parsed DAC table */ |
| 18662 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 18663 | const struct auto_pin_cfg *cfg) |
| 18664 | { |
| 18665 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18666 | static const char *chname[4] = { |
| 18667 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 18668 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18669 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18670 | int i, err; |
| 18671 | |
| 18672 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18673 | nid = spec->multiout.dac_nids[i]; |
| 18674 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18675 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18676 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 18677 | if (!mix) |
| 18678 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18679 | if (i == 2) { |
| 18680 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18681 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18682 | if (err < 0) |
| 18683 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18684 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18685 | if (err < 0) |
| 18686 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18687 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18688 | if (err < 0) |
| 18689 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18690 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18691 | if (err < 0) |
| 18692 | return err; |
| 18693 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18694 | const char *pfx; |
| 18695 | if (cfg->line_outs == 1 && |
| 18696 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18697 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18698 | pfx = "Speaker"; |
| 18699 | else |
| 18700 | pfx = "PCM"; |
| 18701 | } else |
| 18702 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18703 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18704 | if (err < 0) |
| 18705 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18706 | if (cfg->line_outs == 1 && |
| 18707 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 18708 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18709 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18710 | if (err < 0) |
| 18711 | return err; |
| 18712 | } |
| 18713 | } |
| 18714 | return 0; |
| 18715 | } |
| 18716 | |
| 18717 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18718 | /* return DAC nid if any new DAC is assigned */ |
| 18719 | 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] | 18720 | const char *pfx) |
| 18721 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18722 | struct alc_spec *spec = codec->spec; |
| 18723 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18724 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18725 | |
| 18726 | if (!pin) |
| 18727 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18728 | nid = alc662_look_for_dac(codec, pin); |
| 18729 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18730 | /* the corresponding DAC is already occupied */ |
| 18731 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 18732 | return 0; /* no way */ |
| 18733 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18734 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18735 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 18736 | } |
| 18737 | |
| 18738 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 18739 | if (!mix) |
| 18740 | return 0; |
| 18741 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 18742 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 18743 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18744 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 18745 | if (err < 0) |
| 18746 | return err; |
| 18747 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18748 | } |
| 18749 | |
| 18750 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18751 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 18752 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18753 | |
| 18754 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 18755 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18756 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18757 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18758 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 18759 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18760 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18761 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18762 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18763 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 18764 | if (num <= 1) |
| 18765 | return; |
| 18766 | for (i = 0; i < num; i++) { |
| 18767 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 18768 | continue; |
| 18769 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 18770 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18771 | } |
| 18772 | } |
| 18773 | |
| 18774 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 18775 | { |
| 18776 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18777 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18778 | int i; |
| 18779 | |
| 18780 | for (i = 0; i <= HDA_SIDE; i++) { |
| 18781 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 18782 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 18783 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18784 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18785 | } |
| 18786 | } |
| 18787 | |
| 18788 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 18789 | { |
| 18790 | struct alc_spec *spec = codec->spec; |
| 18791 | hda_nid_t pin; |
| 18792 | |
| 18793 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18794 | if (pin) |
| 18795 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 18796 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18797 | pin = spec->autocfg.speaker_pins[0]; |
| 18798 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18799 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 18800 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18801 | } |
| 18802 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18803 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 18804 | |
| 18805 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 18806 | { |
| 18807 | struct alc_spec *spec = codec->spec; |
| 18808 | int i; |
| 18809 | |
| 18810 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 18811 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18812 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 18813 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 18814 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 18815 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18816 | snd_hda_codec_write(codec, nid, 0, |
| 18817 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 18818 | AMP_OUT_MUTE); |
| 18819 | } |
| 18820 | } |
| 18821 | } |
| 18822 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18823 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 18824 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18825 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 18826 | { |
| 18827 | struct alc_spec *spec = codec->spec; |
| 18828 | int err; |
| 18829 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 18830 | |
| 18831 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 18832 | alc662_ignore); |
| 18833 | if (err < 0) |
| 18834 | return err; |
| 18835 | if (!spec->autocfg.line_outs) |
| 18836 | return 0; /* can't find valid BIOS pin config */ |
| 18837 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18838 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18839 | if (err < 0) |
| 18840 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18841 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18842 | if (err < 0) |
| 18843 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18844 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18845 | spec->autocfg.speaker_pins[0], |
| 18846 | "Speaker"); |
| 18847 | if (err < 0) |
| 18848 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18849 | if (err) |
| 18850 | spec->multiout.extra_out_nid[0] = err; |
| 18851 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18852 | "Headphone"); |
| 18853 | if (err < 0) |
| 18854 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18855 | if (err) |
| 18856 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18857 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18858 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18859 | return err; |
| 18860 | |
| 18861 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 18862 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 18863 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18864 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 18865 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 18866 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18867 | |
| 18868 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 18869 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 18870 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18871 | add_verb(spec, alc662_init_verbs); |
| 18872 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 18873 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18874 | add_verb(spec, alc663_init_verbs); |
| 18875 | |
| 18876 | if (codec->vendor_id == 0x10ec0272) |
| 18877 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 18878 | |
| 18879 | err = alc_auto_add_mic_boost(codec); |
| 18880 | if (err < 0) |
| 18881 | return err; |
| 18882 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18883 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 18884 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 18885 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 18886 | else |
| 18887 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 18888 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18889 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18890 | } |
| 18891 | |
| 18892 | /* additional initialization for auto-configuration model */ |
| 18893 | static void alc662_auto_init(struct hda_codec *codec) |
| 18894 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18895 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18896 | alc662_auto_init_multi_out(codec); |
| 18897 | alc662_auto_init_hp_out(codec); |
| 18898 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18899 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 18900 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18901 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 18902 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18903 | } |
| 18904 | |
| 18905 | static int patch_alc662(struct hda_codec *codec) |
| 18906 | { |
| 18907 | struct alc_spec *spec; |
| 18908 | int err, board_config; |
| 18909 | |
| 18910 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 18911 | if (!spec) |
| 18912 | return -ENOMEM; |
| 18913 | |
| 18914 | codec->spec = spec; |
| 18915 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 18916 | alc_auto_parse_customize_define(codec); |
| 18917 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 18918 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 18919 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 18920 | if (alc_read_coef_idx(codec, 0) == 0x8020) |
| 18921 | alc_codec_rename(codec, "ALC661"); |
| 18922 | else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) && |
| 18923 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 18924 | spec->cdefine.platform_type == 1) |
| 18925 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18926 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18927 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 18928 | alc662_models, |
| 18929 | alc662_cfg_tbl); |
| 18930 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 18931 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 18932 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18933 | board_config = ALC662_AUTO; |
| 18934 | } |
| 18935 | |
| 18936 | if (board_config == ALC662_AUTO) { |
| 18937 | /* automatic parse from the BIOS config */ |
| 18938 | err = alc662_parse_auto_config(codec); |
| 18939 | if (err < 0) { |
| 18940 | alc_free(codec); |
| 18941 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18942 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18943 | printk(KERN_INFO |
| 18944 | "hda_codec: Cannot set up configuration " |
| 18945 | "from BIOS. Using base mode...\n"); |
| 18946 | board_config = ALC662_3ST_2ch_DIG; |
| 18947 | } |
| 18948 | } |
| 18949 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 18950 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 18951 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 18952 | if (err < 0) { |
| 18953 | alc_free(codec); |
| 18954 | return err; |
| 18955 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 18956 | } |
| 18957 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18958 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 18959 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18960 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18961 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 18962 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 18963 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18964 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 18965 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 18966 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 18967 | if (!spec->adc_nids) { |
| 18968 | spec->adc_nids = alc662_adc_nids; |
| 18969 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 18970 | } |
| 18971 | if (!spec->capsrc_nids) |
| 18972 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18973 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18974 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18975 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18976 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 18977 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 18978 | switch (codec->vendor_id) { |
| 18979 | case 0x10ec0662: |
| 18980 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 18981 | break; |
| 18982 | case 0x10ec0272: |
| 18983 | case 0x10ec0663: |
| 18984 | case 0x10ec0665: |
| 18985 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 18986 | break; |
| 18987 | case 0x10ec0273: |
| 18988 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 18989 | break; |
| 18990 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18991 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 18992 | spec->vmaster_nid = 0x02; |
| 18993 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18994 | codec->patch_ops = alc_patch_ops; |
| 18995 | if (board_config == ALC662_AUTO) |
| 18996 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18997 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18998 | if (!spec->loopback.amplist) |
| 18999 | spec->loopback.amplist = alc662_loopbacks; |
| 19000 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19001 | |
| 19002 | return 0; |
| 19003 | } |
| 19004 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19005 | static int patch_alc888(struct hda_codec *codec) |
| 19006 | { |
| 19007 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19008 | kfree(codec->chip_name); |
| 19009 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19010 | if (!codec->chip_name) { |
| 19011 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19012 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19013 | } |
| 19014 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19015 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19016 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19017 | } |
| 19018 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19019 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19020 | * ALC680 support |
| 19021 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19022 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19023 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19024 | #define alc680_modes alc260_modes |
| 19025 | |
| 19026 | static hda_nid_t alc680_dac_nids[3] = { |
| 19027 | /* Lout1, Lout2, hp */ |
| 19028 | 0x02, 0x03, 0x04 |
| 19029 | }; |
| 19030 | |
| 19031 | static hda_nid_t alc680_adc_nids[3] = { |
| 19032 | /* ADC0-2 */ |
| 19033 | /* DMIC, MIC, Line-in*/ |
| 19034 | 0x07, 0x08, 0x09 |
| 19035 | }; |
| 19036 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19037 | /* |
| 19038 | * Analog capture ADC cgange |
| 19039 | */ |
| 19040 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19041 | struct hda_codec *codec, |
| 19042 | unsigned int stream_tag, |
| 19043 | unsigned int format, |
| 19044 | struct snd_pcm_substream *substream) |
| 19045 | { |
| 19046 | struct alc_spec *spec = codec->spec; |
| 19047 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19048 | unsigned int pre_mic, pre_line; |
| 19049 | |
| 19050 | pre_mic = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_MIC]); |
| 19051 | pre_line = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_LINE]); |
| 19052 | |
| 19053 | spec->cur_adc_stream_tag = stream_tag; |
| 19054 | spec->cur_adc_format = format; |
| 19055 | |
| 19056 | if (pre_mic || pre_line) { |
| 19057 | if (pre_mic) |
| 19058 | snd_hda_codec_setup_stream(codec, 0x08, stream_tag, 0, |
| 19059 | format); |
| 19060 | else |
| 19061 | snd_hda_codec_setup_stream(codec, 0x09, stream_tag, 0, |
| 19062 | format); |
| 19063 | } else |
| 19064 | snd_hda_codec_setup_stream(codec, 0x07, stream_tag, 0, format); |
| 19065 | return 0; |
| 19066 | } |
| 19067 | |
| 19068 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19069 | struct hda_codec *codec, |
| 19070 | struct snd_pcm_substream *substream) |
| 19071 | { |
| 19072 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19073 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19074 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19075 | return 0; |
| 19076 | } |
| 19077 | |
| 19078 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
| 19079 | .substreams = 1, /* can be overridden */ |
| 19080 | .channels_min = 2, |
| 19081 | .channels_max = 2, |
| 19082 | /* NID is set in alc_build_pcms */ |
| 19083 | .ops = { |
| 19084 | .prepare = alc680_capture_pcm_prepare, |
| 19085 | .cleanup = alc680_capture_pcm_cleanup |
| 19086 | }, |
| 19087 | }; |
| 19088 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19089 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 19090 | /* output mixer control */ |
| 19091 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19092 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19093 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19094 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19095 | HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19096 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19097 | HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19098 | { } |
| 19099 | }; |
| 19100 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19101 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
| 19102 | .ops = &snd_hda_bind_vol, |
| 19103 | .values = { |
| 19104 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19105 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19106 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19107 | 0 |
| 19108 | }, |
| 19109 | }; |
| 19110 | |
| 19111 | static struct hda_bind_ctls alc680_bind_cap_switch = { |
| 19112 | .ops = &snd_hda_bind_sw, |
| 19113 | .values = { |
| 19114 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19115 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19116 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19117 | 0 |
| 19118 | }, |
| 19119 | }; |
| 19120 | |
| 19121 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
| 19122 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19123 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19124 | { } /* end */ |
| 19125 | }; |
| 19126 | |
| 19127 | /* |
| 19128 | * generic initialization of ADC, input mixers and output mixers |
| 19129 | */ |
| 19130 | static struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19131 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19132 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19133 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19134 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19135 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19136 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19137 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19138 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19139 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19140 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19141 | |
| 19142 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19143 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19144 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19145 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19146 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19147 | |
| 19148 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19149 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 19150 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19151 | { } |
| 19152 | }; |
| 19153 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19154 | /* toggle speaker-output according to the hp-jack state */ |
| 19155 | static void alc680_base_setup(struct hda_codec *codec) |
| 19156 | { |
| 19157 | struct alc_spec *spec = codec->spec; |
| 19158 | |
| 19159 | spec->autocfg.hp_pins[0] = 0x16; |
| 19160 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19161 | spec->autocfg.speaker_pins[1] = 0x15; |
| 19162 | spec->autocfg.input_pins[AUTO_PIN_MIC] = 0x18; |
| 19163 | spec->autocfg.input_pins[AUTO_PIN_LINE] = 0x19; |
| 19164 | } |
| 19165 | |
| 19166 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19167 | { |
| 19168 | struct alc_spec *spec = codec->spec; |
| 19169 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19170 | unsigned int present; |
| 19171 | hda_nid_t new_adc; |
| 19172 | |
| 19173 | present = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_MIC]); |
| 19174 | |
| 19175 | new_adc = present ? 0x8 : 0x7; |
| 19176 | __snd_hda_codec_cleanup_stream(codec, !present ? 0x8 : 0x7, 1); |
| 19177 | snd_hda_codec_setup_stream(codec, new_adc, |
| 19178 | spec->cur_adc_stream_tag, 0, |
| 19179 | spec->cur_adc_format); |
| 19180 | |
| 19181 | } |
| 19182 | |
| 19183 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19184 | unsigned int res) |
| 19185 | { |
| 19186 | if ((res >> 26) == ALC880_HP_EVENT) |
| 19187 | alc_automute_amp(codec); |
| 19188 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19189 | alc680_rec_autoswitch(codec); |
| 19190 | } |
| 19191 | |
| 19192 | static void alc680_inithook(struct hda_codec *codec) |
| 19193 | { |
| 19194 | alc_automute_amp(codec); |
| 19195 | alc680_rec_autoswitch(codec); |
| 19196 | } |
| 19197 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19198 | /* create input playback/capture controls for the given pin */ |
| 19199 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19200 | const char *ctlname, int idx) |
| 19201 | { |
| 19202 | hda_nid_t dac; |
| 19203 | int err; |
| 19204 | |
| 19205 | switch (nid) { |
| 19206 | case 0x14: |
| 19207 | dac = 0x02; |
| 19208 | break; |
| 19209 | case 0x15: |
| 19210 | dac = 0x03; |
| 19211 | break; |
| 19212 | case 0x16: |
| 19213 | dac = 0x04; |
| 19214 | break; |
| 19215 | default: |
| 19216 | return 0; |
| 19217 | } |
| 19218 | if (spec->multiout.dac_nids[0] != dac && |
| 19219 | spec->multiout.dac_nids[1] != dac) { |
| 19220 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19221 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19222 | HDA_OUTPUT)); |
| 19223 | if (err < 0) |
| 19224 | return err; |
| 19225 | |
| 19226 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19227 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19228 | |
| 19229 | if (err < 0) |
| 19230 | return err; |
| 19231 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19232 | } |
| 19233 | |
| 19234 | return 0; |
| 19235 | } |
| 19236 | |
| 19237 | /* add playback controls from the parsed DAC table */ |
| 19238 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19239 | const struct auto_pin_cfg *cfg) |
| 19240 | { |
| 19241 | hda_nid_t nid; |
| 19242 | int err; |
| 19243 | |
| 19244 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19245 | |
| 19246 | nid = cfg->line_out_pins[0]; |
| 19247 | if (nid) { |
| 19248 | const char *name; |
| 19249 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19250 | name = "Speaker"; |
| 19251 | else |
| 19252 | name = "Front"; |
| 19253 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19254 | if (err < 0) |
| 19255 | return err; |
| 19256 | } |
| 19257 | |
| 19258 | nid = cfg->speaker_pins[0]; |
| 19259 | if (nid) { |
| 19260 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19261 | if (err < 0) |
| 19262 | return err; |
| 19263 | } |
| 19264 | nid = cfg->hp_pins[0]; |
| 19265 | if (nid) { |
| 19266 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19267 | if (err < 0) |
| 19268 | return err; |
| 19269 | } |
| 19270 | |
| 19271 | return 0; |
| 19272 | } |
| 19273 | |
| 19274 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19275 | hda_nid_t nid, int pin_type) |
| 19276 | { |
| 19277 | alc_set_pin_output(codec, nid, pin_type); |
| 19278 | } |
| 19279 | |
| 19280 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19281 | { |
| 19282 | struct alc_spec *spec = codec->spec; |
| 19283 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19284 | if (nid) { |
| 19285 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19286 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19287 | } |
| 19288 | } |
| 19289 | |
| 19290 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19291 | { |
| 19292 | struct alc_spec *spec = codec->spec; |
| 19293 | hda_nid_t pin; |
| 19294 | |
| 19295 | pin = spec->autocfg.hp_pins[0]; |
| 19296 | if (pin) |
| 19297 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19298 | pin = spec->autocfg.speaker_pins[0]; |
| 19299 | if (pin) |
| 19300 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19301 | } |
| 19302 | |
| 19303 | /* pcm configuration: identical with ALC880 */ |
| 19304 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19305 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19306 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19307 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19308 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19309 | |
| 19310 | /* |
| 19311 | * BIOS auto configuration |
| 19312 | */ |
| 19313 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19314 | { |
| 19315 | struct alc_spec *spec = codec->spec; |
| 19316 | int err; |
| 19317 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19318 | |
| 19319 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19320 | alc680_ignore); |
| 19321 | if (err < 0) |
| 19322 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19323 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19324 | if (!spec->autocfg.line_outs) { |
| 19325 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19326 | spec->multiout.max_channels = 2; |
| 19327 | spec->no_analog = 1; |
| 19328 | goto dig_only; |
| 19329 | } |
| 19330 | return 0; /* can't find valid BIOS pin config */ |
| 19331 | } |
| 19332 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19333 | if (err < 0) |
| 19334 | return err; |
| 19335 | |
| 19336 | spec->multiout.max_channels = 2; |
| 19337 | |
| 19338 | dig_only: |
| 19339 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19340 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19341 | if (spec->kctls.list) |
| 19342 | add_mixer(spec, spec->kctls.list); |
| 19343 | |
| 19344 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19345 | |
| 19346 | err = alc_auto_add_mic_boost(codec); |
| 19347 | if (err < 0) |
| 19348 | return err; |
| 19349 | |
| 19350 | return 1; |
| 19351 | } |
| 19352 | |
| 19353 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19354 | |
| 19355 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19356 | static void alc680_auto_init(struct hda_codec *codec) |
| 19357 | { |
| 19358 | struct alc_spec *spec = codec->spec; |
| 19359 | alc680_auto_init_multi_out(codec); |
| 19360 | alc680_auto_init_hp_out(codec); |
| 19361 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19362 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19363 | if (spec->unsol_event) |
| 19364 | alc_inithook(codec); |
| 19365 | } |
| 19366 | |
| 19367 | /* |
| 19368 | * configuration and preset |
| 19369 | */ |
| 19370 | static const char *alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19371 | [ALC680_BASE] = "base", |
| 19372 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19373 | }; |
| 19374 | |
| 19375 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 19376 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19377 | {} |
| 19378 | }; |
| 19379 | |
| 19380 | static struct alc_config_preset alc680_presets[] = { |
| 19381 | [ALC680_BASE] = { |
| 19382 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19383 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19384 | .init_verbs = { alc680_init_verbs }, |
| 19385 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19386 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19387 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19388 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19389 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19390 | .unsol_event = alc680_unsol_event, |
| 19391 | .setup = alc680_base_setup, |
| 19392 | .init_hook = alc680_inithook, |
| 19393 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19394 | }, |
| 19395 | }; |
| 19396 | |
| 19397 | static int patch_alc680(struct hda_codec *codec) |
| 19398 | { |
| 19399 | struct alc_spec *spec; |
| 19400 | int board_config; |
| 19401 | int err; |
| 19402 | |
| 19403 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19404 | if (spec == NULL) |
| 19405 | return -ENOMEM; |
| 19406 | |
| 19407 | codec->spec = spec; |
| 19408 | |
| 19409 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 19410 | alc680_models, |
| 19411 | alc680_cfg_tbl); |
| 19412 | |
| 19413 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 19414 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19415 | codec->chip_name); |
| 19416 | board_config = ALC680_AUTO; |
| 19417 | } |
| 19418 | |
| 19419 | if (board_config == ALC680_AUTO) { |
| 19420 | /* automatic parse from the BIOS config */ |
| 19421 | err = alc680_parse_auto_config(codec); |
| 19422 | if (err < 0) { |
| 19423 | alc_free(codec); |
| 19424 | return err; |
| 19425 | } else if (!err) { |
| 19426 | printk(KERN_INFO |
| 19427 | "hda_codec: Cannot set up configuration " |
| 19428 | "from BIOS. Using base mode...\n"); |
| 19429 | board_config = ALC680_BASE; |
| 19430 | } |
| 19431 | } |
| 19432 | |
| 19433 | if (board_config != ALC680_AUTO) |
| 19434 | setup_preset(codec, &alc680_presets[board_config]); |
| 19435 | |
| 19436 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19437 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19438 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19439 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19440 | |
| 19441 | if (!spec->adc_nids) { |
| 19442 | spec->adc_nids = alc680_adc_nids; |
| 19443 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 19444 | } |
| 19445 | |
| 19446 | if (!spec->cap_mixer) |
| 19447 | set_capture_mixer(codec); |
| 19448 | |
| 19449 | spec->vmaster_nid = 0x02; |
| 19450 | |
| 19451 | codec->patch_ops = alc_patch_ops; |
| 19452 | if (board_config == ALC680_AUTO) |
| 19453 | spec->init_hook = alc680_auto_init; |
| 19454 | |
| 19455 | return 0; |
| 19456 | } |
| 19457 | |
| 19458 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19459 | * patch entries |
| 19460 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19461 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19462 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19463 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19464 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 19465 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19466 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19467 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 19468 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19469 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19470 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19471 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19472 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 19473 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 19474 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19475 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19476 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19477 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 19478 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 19479 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19480 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19481 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19482 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19483 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19484 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19485 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 19486 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19487 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 19488 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19489 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19490 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19491 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 19492 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19493 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19494 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19495 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19496 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19497 | {} /* terminator */ |
| 19498 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19499 | |
| 19500 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 19501 | |
| 19502 | MODULE_LICENSE("GPL"); |
| 19503 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 19504 | |
| 19505 | static struct hda_codec_preset_list realtek_list = { |
| 19506 | .preset = snd_hda_preset_realtek, |
| 19507 | .owner = THIS_MODULE, |
| 19508 | }; |
| 19509 | |
| 19510 | static int __init patch_realtek_init(void) |
| 19511 | { |
| 19512 | return snd_hda_add_codec_preset(&realtek_list); |
| 19513 | } |
| 19514 | |
| 19515 | static void __exit patch_realtek_exit(void) |
| 19516 | { |
| 19517 | snd_hda_delete_codec_preset(&realtek_list); |
| 19518 | } |
| 19519 | |
| 19520 | module_init(patch_realtek_init) |
| 19521 | module_exit(patch_realtek_exit) |