Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 33 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 63 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_SND_DEBUG |
| 65 | ALC880_TEST, |
| 66 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 67 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 68 | ALC880_MODEL_LAST /* last tag */ |
| 69 | }; |
| 70 | |
| 71 | /* ALC260 models */ |
| 72 | enum { |
| 73 | ALC260_BASIC, |
| 74 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 75 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 76 | ALC260_HP_3013, |
| 77 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 78 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 79 | ALC260_WILL, |
| 80 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 81 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 82 | #ifdef CONFIG_SND_DEBUG |
| 83 | ALC260_TEST, |
| 84 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 85 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 86 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 89 | /* ALC262 models */ |
| 90 | enum { |
| 91 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 92 | ALC262_HIPPO, |
| 93 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 94 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 95 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 96 | ALC262_HP_BPC_D7000_WL, |
| 97 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 98 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 99 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 100 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 101 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 102 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 103 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 104 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 105 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 106 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 108 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 109 | ALC262_AUTO, |
| 110 | ALC262_MODEL_LAST /* last tag */ |
| 111 | }; |
| 112 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 113 | /* ALC268 models */ |
| 114 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 115 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 116 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 117 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 118 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 119 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 120 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 121 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 122 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 123 | #ifdef CONFIG_SND_DEBUG |
| 124 | ALC268_TEST, |
| 125 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 126 | ALC268_AUTO, |
| 127 | ALC268_MODEL_LAST /* last tag */ |
| 128 | }; |
| 129 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 130 | /* ALC269 models */ |
| 131 | enum { |
| 132 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 133 | ALC269_QUANTA_FL1, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 134 | ALC269_AMIC, |
| 135 | ALC269_DMIC, |
| 136 | ALC269VB_AMIC, |
| 137 | ALC269VB_DMIC, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 138 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 139 | ALC269_LIFEBOOK, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 140 | ALC269_AUTO, |
| 141 | ALC269_MODEL_LAST /* last tag */ |
| 142 | }; |
| 143 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 144 | /* ALC861 models */ |
| 145 | enum { |
| 146 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 147 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 148 | ALC861_3ST_DIG, |
| 149 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 150 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 151 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 152 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 153 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 154 | ALC861_AUTO, |
| 155 | ALC861_MODEL_LAST, |
| 156 | }; |
| 157 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 158 | /* ALC861-VD models */ |
| 159 | enum { |
| 160 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 161 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 162 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 163 | ALC861VD_3ST, |
| 164 | ALC861VD_3ST_DIG, |
| 165 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 166 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 167 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 168 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 169 | ALC861VD_AUTO, |
| 170 | ALC861VD_MODEL_LAST, |
| 171 | }; |
| 172 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 173 | /* ALC662 models */ |
| 174 | enum { |
| 175 | ALC662_3ST_2ch_DIG, |
| 176 | ALC662_3ST_6ch_DIG, |
| 177 | ALC662_3ST_6ch, |
| 178 | ALC662_5ST_DIG, |
| 179 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 180 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 181 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 182 | ALC663_ASUS_M51VA, |
| 183 | ALC663_ASUS_G71V, |
| 184 | ALC663_ASUS_H13, |
| 185 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 186 | ALC662_ECS, |
| 187 | ALC663_ASUS_MODE1, |
| 188 | ALC662_ASUS_MODE2, |
| 189 | ALC663_ASUS_MODE3, |
| 190 | ALC663_ASUS_MODE4, |
| 191 | ALC663_ASUS_MODE5, |
| 192 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 193 | ALC663_ASUS_MODE7, |
| 194 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 195 | ALC272_DELL, |
| 196 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 197 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 198 | ALC662_AUTO, |
| 199 | ALC662_MODEL_LAST, |
| 200 | }; |
| 201 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 202 | /* ALC882 models */ |
| 203 | enum { |
| 204 | ALC882_3ST_DIG, |
| 205 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 206 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 207 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 208 | ALC882_TARGA, |
| 209 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 210 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 211 | ALC885_MACPRO, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 212 | ALC885_MBA21, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 213 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 214 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 215 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 216 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 217 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 218 | ALC883_3ST_2ch_DIG, |
| 219 | ALC883_3ST_6ch_DIG, |
| 220 | ALC883_3ST_6ch, |
| 221 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 222 | ALC883_TARGA_DIG, |
| 223 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 224 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 225 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 226 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 227 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 228 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 231 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 232 | ALC883_MEDION_MD2, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 233 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 234 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 235 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 236 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 237 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 238 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 239 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 240 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 241 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 242 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 243 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 244 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 245 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 246 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 247 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 248 | ALC889A_INTEL, |
| 249 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 250 | ALC888_ASUS_M90V, |
| 251 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 252 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 253 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 254 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 255 | ALC882_AUTO, |
| 256 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 257 | }; |
| 258 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 259 | /* for GPIO Poll */ |
| 260 | #define GPIO_MASK 0x03 |
| 261 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 262 | /* extra amp-initialization sequence types */ |
| 263 | enum { |
| 264 | ALC_INIT_NONE, |
| 265 | ALC_INIT_DEFAULT, |
| 266 | ALC_INIT_GPIO1, |
| 267 | ALC_INIT_GPIO2, |
| 268 | ALC_INIT_GPIO3, |
| 269 | }; |
| 270 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 271 | struct alc_mic_route { |
| 272 | hda_nid_t pin; |
| 273 | unsigned char mux_idx; |
| 274 | unsigned char amix_idx; |
| 275 | }; |
| 276 | |
| 277 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 278 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 279 | struct alc_customize_define { |
| 280 | unsigned int sku_cfg; |
| 281 | unsigned char port_connectivity; |
| 282 | unsigned char check_sum; |
| 283 | unsigned char customization; |
| 284 | unsigned char external_amp; |
| 285 | unsigned int enable_pcbeep:1; |
| 286 | unsigned int platform_type:1; |
| 287 | unsigned int swap:1; |
| 288 | unsigned int override:1; |
| 289 | }; |
| 290 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 291 | struct alc_spec { |
| 292 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 293 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 295 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 296 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 298 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 299 | * don't forget NULL |
| 300 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 301 | */ |
| 302 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 304 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | struct hda_pcm_stream *stream_analog_playback; |
| 306 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 307 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 308 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 310 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | struct hda_pcm_stream *stream_digital_playback; |
| 312 | struct hda_pcm_stream *stream_digital_capture; |
| 313 | |
| 314 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 315 | struct hda_multi_out multiout; /* playback set-up |
| 316 | * max_channels, dacs must be set |
| 317 | * dig_out_nid and hp_nid are optional |
| 318 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 319 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 320 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 321 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | |
| 323 | /* capture */ |
| 324 | unsigned int num_adc_nids; |
| 325 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 326 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 327 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | |
| 329 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 330 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 331 | const struct hda_input_mux *input_mux; |
| 332 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 333 | struct alc_mic_route ext_mic; |
| 334 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | |
| 336 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 337 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 339 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 340 | int const_channel_count; |
| 341 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | |
| 343 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 344 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 345 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 346 | /* dynamic controls, init_verbs and input_mux */ |
| 347 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 348 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 349 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 350 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 351 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 352 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 353 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 354 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 355 | /* hooks */ |
| 356 | void (*init_hook)(struct hda_codec *codec); |
| 357 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 358 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 359 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 360 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 361 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 362 | /* for pin sensing */ |
| 363 | unsigned int sense_updated: 1; |
| 364 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 365 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 366 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 367 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 368 | /* other flags */ |
| 369 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 370 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 371 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 372 | /* for virtual master */ |
| 373 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 374 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 375 | struct hda_loopback_check loopback; |
| 376 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 377 | |
| 378 | /* for PLL fix */ |
| 379 | hda_nid_t pll_nid; |
| 380 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 381 | }; |
| 382 | |
| 383 | /* |
| 384 | * configuration template - to be copied to the spec instance |
| 385 | */ |
| 386 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 387 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 388 | * with spec |
| 389 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 390 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 391 | const struct hda_verb *init_verbs[5]; |
| 392 | unsigned int num_dacs; |
| 393 | hda_nid_t *dac_nids; |
| 394 | hda_nid_t dig_out_nid; /* optional */ |
| 395 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 396 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 397 | unsigned int num_adc_nids; |
| 398 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 399 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 400 | hda_nid_t dig_in_nid; |
| 401 | unsigned int num_channel_mode; |
| 402 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 403 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 404 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 405 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 406 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 407 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 408 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 409 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 410 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 411 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 412 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 413 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 414 | }; |
| 415 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 416 | |
| 417 | /* |
| 418 | * input MUX handling |
| 419 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 420 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 421 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 422 | { |
| 423 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 424 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 425 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 426 | if (mux_idx >= spec->num_mux_defs) |
| 427 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 428 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 429 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 430 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 431 | } |
| 432 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 433 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 434 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 435 | { |
| 436 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 437 | struct alc_spec *spec = codec->spec; |
| 438 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 439 | |
| 440 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 441 | return 0; |
| 442 | } |
| 443 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 444 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 445 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | { |
| 447 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 448 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 449 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 450 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 451 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 452 | hda_nid_t nid = spec->capsrc_nids ? |
| 453 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 454 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 456 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 457 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 458 | if (!imux->num_items && mux_idx > 0) |
| 459 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 460 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 461 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 462 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 463 | /* Matrix-mixer style (e.g. ALC882) */ |
| 464 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 465 | unsigned int i, idx; |
| 466 | |
| 467 | idx = ucontrol->value.enumerated.item[0]; |
| 468 | if (idx >= imux->num_items) |
| 469 | idx = imux->num_items - 1; |
| 470 | if (*cur_val == idx) |
| 471 | return 0; |
| 472 | for (i = 0; i < imux->num_items; i++) { |
| 473 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 474 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 475 | imux->items[i].index, |
| 476 | HDA_AMP_MUTE, v); |
| 477 | } |
| 478 | *cur_val = idx; |
| 479 | return 1; |
| 480 | } else { |
| 481 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 482 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 483 | &spec->cur_mux[adc_idx]); |
| 484 | } |
| 485 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 486 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 487 | /* |
| 488 | * channel mode setting |
| 489 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 490 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 491 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 492 | { |
| 493 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 494 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 495 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 496 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 497 | } |
| 498 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 499 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 500 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | { |
| 502 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 503 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 504 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 505 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 506 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 507 | } |
| 508 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 509 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 510 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 511 | { |
| 512 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 513 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 514 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 515 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 516 | &spec->ext_channel_count); |
| 517 | if (err >= 0 && !spec->const_channel_count) { |
| 518 | spec->multiout.max_channels = spec->ext_channel_count; |
| 519 | if (spec->need_dac_fix) |
| 520 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 521 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 522 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 523 | } |
| 524 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 525 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 526 | * 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] | 527 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 528 | * being part of a format specifier. Maximum allowed length of a value is |
| 529 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 530 | * |
| 531 | * Note: some retasking pin complexes seem to ignore requests for input |
| 532 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 533 | * are requested. Therefore order this list so that this behaviour will not |
| 534 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 535 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 536 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 537 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 538 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 539 | "Mic 50pc bias", "Mic 80pc bias", |
| 540 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 541 | }; |
| 542 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 543 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 544 | }; |
| 545 | /* 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] | 546 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 547 | * addition, "input" pins may or may not process the mic bias option |
| 548 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 549 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 550 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 551 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 552 | #define ALC_PIN_DIR_IN 0x00 |
| 553 | #define ALC_PIN_DIR_OUT 0x01 |
| 554 | #define ALC_PIN_DIR_INOUT 0x02 |
| 555 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 556 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 557 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 558 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 559 | * For each direction the minimum and maximum values are given. |
| 560 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 561 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 562 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 563 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 564 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 565 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 566 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 567 | }; |
| 568 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 569 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 570 | #define alc_pin_mode_n_items(_dir) \ |
| 571 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 572 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 573 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 574 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 575 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 576 | unsigned int item_num = uinfo->value.enumerated.item; |
| 577 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 578 | |
| 579 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 580 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 581 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 582 | |
| 583 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 584 | item_num = alc_pin_mode_min(dir); |
| 585 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 586 | return 0; |
| 587 | } |
| 588 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 589 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 590 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 591 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 592 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 593 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 594 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 595 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 596 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 597 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 598 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 599 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 600 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 601 | /* Find enumerated value for current pinctl setting */ |
| 602 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 603 | 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] | 604 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 605 | *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] | 606 | return 0; |
| 607 | } |
| 608 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 609 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 610 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 611 | { |
| 612 | signed int change; |
| 613 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 614 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 615 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 616 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 617 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 618 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 619 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 620 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 621 | 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] | 622 | val = alc_pin_mode_min(dir); |
| 623 | |
| 624 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 625 | if (change) { |
| 626 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 627 | snd_hda_codec_write_cache(codec, nid, 0, |
| 628 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 629 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 630 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 631 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 632 | * for the requested pin mode. Enum values of 2 or less are |
| 633 | * input modes. |
| 634 | * |
| 635 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 636 | * reduces noise slightly (particularly on input) so we'll |
| 637 | * do it. However, having both input and output buffers |
| 638 | * enabled simultaneously doesn't seem to be problematic if |
| 639 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 640 | */ |
| 641 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 642 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 643 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 644 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 645 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 646 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 647 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 648 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 649 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 650 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 651 | } |
| 652 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 653 | return change; |
| 654 | } |
| 655 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 656 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 657 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 658 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 659 | .info = alc_pin_mode_info, \ |
| 660 | .get = alc_pin_mode_get, \ |
| 661 | .put = alc_pin_mode_put, \ |
| 662 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 663 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 664 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 665 | * together using a mask with more than one bit set. This control is |
| 666 | * currently used only by the ALC260 test model. At this stage they are not |
| 667 | * needed for any "production" models. |
| 668 | */ |
| 669 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 670 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 671 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 672 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 673 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 674 | { |
| 675 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 676 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 677 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 678 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 679 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 680 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 681 | |
| 682 | *valp = (val & mask) != 0; |
| 683 | return 0; |
| 684 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 685 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 686 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 687 | { |
| 688 | signed int change; |
| 689 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 690 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 691 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 692 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 693 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 694 | AC_VERB_GET_GPIO_DATA, |
| 695 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 696 | |
| 697 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 698 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 699 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 700 | gpio_data &= ~mask; |
| 701 | else |
| 702 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 703 | snd_hda_codec_write_cache(codec, nid, 0, |
| 704 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 705 | |
| 706 | return change; |
| 707 | } |
| 708 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 709 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 710 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 711 | .info = alc_gpio_data_info, \ |
| 712 | .get = alc_gpio_data_get, \ |
| 713 | .put = alc_gpio_data_put, \ |
| 714 | .private_value = nid | (mask<<16) } |
| 715 | #endif /* CONFIG_SND_DEBUG */ |
| 716 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 717 | /* A switch control to allow the enabling of the digital IO pins on the |
| 718 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 719 | * to provide something in the test model allowing digital outputs to be |
| 720 | * identified if present. If models are found which can utilise these |
| 721 | * outputs a more complete mixer control can be devised for those models if |
| 722 | * necessary. |
| 723 | */ |
| 724 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 725 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 726 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 727 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 728 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 729 | { |
| 730 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 731 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 732 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 733 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 734 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 735 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 736 | |
| 737 | *valp = (val & mask) != 0; |
| 738 | return 0; |
| 739 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 740 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 741 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 742 | { |
| 743 | signed int change; |
| 744 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 745 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 746 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 747 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 748 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 749 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 750 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 751 | |
| 752 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 753 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 754 | if (val==0) |
| 755 | ctrl_data &= ~mask; |
| 756 | else |
| 757 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 758 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 759 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 760 | |
| 761 | return change; |
| 762 | } |
| 763 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 764 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 765 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 766 | .info = alc_spdif_ctrl_info, \ |
| 767 | .get = alc_spdif_ctrl_get, \ |
| 768 | .put = alc_spdif_ctrl_put, \ |
| 769 | .private_value = nid | (mask<<16) } |
| 770 | #endif /* CONFIG_SND_DEBUG */ |
| 771 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 772 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 773 | * Again, this is only used in the ALC26x test models to help identify when |
| 774 | * the EAPD line must be asserted for features to work. |
| 775 | */ |
| 776 | #ifdef CONFIG_SND_DEBUG |
| 777 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 778 | |
| 779 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 780 | struct snd_ctl_elem_value *ucontrol) |
| 781 | { |
| 782 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 783 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 784 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 785 | long *valp = ucontrol->value.integer.value; |
| 786 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 787 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 788 | |
| 789 | *valp = (val & mask) != 0; |
| 790 | return 0; |
| 791 | } |
| 792 | |
| 793 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 794 | struct snd_ctl_elem_value *ucontrol) |
| 795 | { |
| 796 | int change; |
| 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 val = *ucontrol->value.integer.value; |
| 801 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 802 | AC_VERB_GET_EAPD_BTLENABLE, |
| 803 | 0x00); |
| 804 | |
| 805 | /* Set/unset the masked control bit(s) as needed */ |
| 806 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 807 | if (!val) |
| 808 | ctrl_data &= ~mask; |
| 809 | else |
| 810 | ctrl_data |= mask; |
| 811 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 812 | ctrl_data); |
| 813 | |
| 814 | return change; |
| 815 | } |
| 816 | |
| 817 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 818 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 819 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 820 | .info = alc_eapd_ctrl_info, \ |
| 821 | .get = alc_eapd_ctrl_get, \ |
| 822 | .put = alc_eapd_ctrl_put, \ |
| 823 | .private_value = nid | (mask<<16) } |
| 824 | #endif /* CONFIG_SND_DEBUG */ |
| 825 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 826 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 827 | * set up the input pin config (depending on the given auto-pin type) |
| 828 | */ |
| 829 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 830 | int auto_pin_type) |
| 831 | { |
| 832 | unsigned int val = PIN_IN; |
| 833 | |
| 834 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 835 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 836 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 837 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 838 | if (pincap & AC_PINCAP_VREF_80) |
| 839 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 840 | else if (pincap & AC_PINCAP_VREF_50) |
| 841 | val = PIN_VREF50; |
| 842 | else if (pincap & AC_PINCAP_VREF_100) |
| 843 | val = PIN_VREF100; |
| 844 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 845 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 846 | } |
| 847 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 848 | } |
| 849 | |
| 850 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 851 | */ |
| 852 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 853 | { |
| 854 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 855 | return; |
| 856 | spec->mixers[spec->num_mixers++] = mix; |
| 857 | } |
| 858 | |
| 859 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 860 | { |
| 861 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 862 | return; |
| 863 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 864 | } |
| 865 | |
| 866 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 867 | * set up from the preset table |
| 868 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 869 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 870 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 871 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 872 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 873 | int i; |
| 874 | |
| 875 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 876 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 877 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 878 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 879 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 880 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 881 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 882 | spec->channel_mode = preset->channel_mode; |
| 883 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 884 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 885 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 886 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 887 | if (preset->const_channel_count) |
| 888 | spec->multiout.max_channels = preset->const_channel_count; |
| 889 | else |
| 890 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 891 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 892 | |
| 893 | spec->multiout.num_dacs = preset->num_dacs; |
| 894 | spec->multiout.dac_nids = preset->dac_nids; |
| 895 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 896 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 897 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 898 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 899 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 900 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 901 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 902 | spec->input_mux = preset->input_mux; |
| 903 | |
| 904 | spec->num_adc_nids = preset->num_adc_nids; |
| 905 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 906 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 907 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 908 | |
| 909 | spec->unsol_event = preset->unsol_event; |
| 910 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 911 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 912 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 913 | spec->loopback.amplist = preset->loopbacks; |
| 914 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 915 | |
| 916 | if (preset->setup) |
| 917 | preset->setup(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 918 | } |
| 919 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 920 | /* Enable GPIO mask and set output */ |
| 921 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 922 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 923 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 924 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 925 | { } |
| 926 | }; |
| 927 | |
| 928 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 929 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 930 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 931 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 932 | { } |
| 933 | }; |
| 934 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 935 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 936 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 937 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 938 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 939 | { } |
| 940 | }; |
| 941 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 942 | /* |
| 943 | * Fix hardware PLL issue |
| 944 | * On some codecs, the analog PLL gating control must be off while |
| 945 | * the default value is 1. |
| 946 | */ |
| 947 | static void alc_fix_pll(struct hda_codec *codec) |
| 948 | { |
| 949 | struct alc_spec *spec = codec->spec; |
| 950 | unsigned int val; |
| 951 | |
| 952 | if (!spec->pll_nid) |
| 953 | return; |
| 954 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 955 | spec->pll_coef_idx); |
| 956 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 957 | AC_VERB_GET_PROC_COEF, 0); |
| 958 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 959 | spec->pll_coef_idx); |
| 960 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 961 | val & ~(1 << spec->pll_coef_bit)); |
| 962 | } |
| 963 | |
| 964 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 965 | unsigned int coef_idx, unsigned int coef_bit) |
| 966 | { |
| 967 | struct alc_spec *spec = codec->spec; |
| 968 | spec->pll_nid = nid; |
| 969 | spec->pll_coef_idx = coef_idx; |
| 970 | spec->pll_coef_bit = coef_bit; |
| 971 | alc_fix_pll(codec); |
| 972 | } |
| 973 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 974 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 975 | { |
| 976 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 977 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 978 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 979 | |
Takashi Iwai | ad87c64 | 2009-11-02 14:23:15 +0100 | [diff] [blame] | 980 | if (!nid) |
| 981 | return; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 982 | spec->jack_present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 983 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 984 | nid = spec->autocfg.speaker_pins[i]; |
| 985 | if (!nid) |
| 986 | break; |
| 987 | snd_hda_codec_write(codec, nid, 0, |
| 988 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 989 | spec->jack_present ? 0 : PIN_OUT); |
| 990 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 991 | } |
| 992 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 993 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 994 | hda_nid_t nid) |
| 995 | { |
| 996 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 997 | int i, nums; |
| 998 | |
| 999 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1000 | for (i = 0; i < nums; i++) |
| 1001 | if (conn[i] == nid) |
| 1002 | return i; |
| 1003 | return -1; |
| 1004 | } |
| 1005 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1006 | static void alc_mic_automute(struct hda_codec *codec) |
| 1007 | { |
| 1008 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1009 | struct alc_mic_route *dead, *alive; |
| 1010 | unsigned int present, type; |
| 1011 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1012 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1013 | if (!spec->auto_mic) |
| 1014 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1015 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1016 | return; |
| 1017 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1018 | return; |
| 1019 | |
| 1020 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1021 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1022 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1023 | if (present) { |
| 1024 | alive = &spec->ext_mic; |
| 1025 | dead = &spec->int_mic; |
| 1026 | } else { |
| 1027 | alive = &spec->int_mic; |
| 1028 | dead = &spec->ext_mic; |
| 1029 | } |
| 1030 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1031 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1032 | if (type == AC_WID_AUD_MIX) { |
| 1033 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1034 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1035 | alive->mux_idx, |
| 1036 | HDA_AMP_MUTE, 0); |
| 1037 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1038 | dead->mux_idx, |
| 1039 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1040 | } else { |
| 1041 | /* MUX style (e.g. ALC880) */ |
| 1042 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1043 | AC_VERB_SET_CONNECT_SEL, |
| 1044 | alive->mux_idx); |
| 1045 | } |
| 1046 | |
| 1047 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1048 | } |
| 1049 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1050 | /* unsolicited event for HP jack sensing */ |
| 1051 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1052 | { |
| 1053 | if (codec->vendor_id == 0x10ec0880) |
| 1054 | res >>= 28; |
| 1055 | else |
| 1056 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1057 | switch (res) { |
| 1058 | case ALC880_HP_EVENT: |
| 1059 | alc_automute_pin(codec); |
| 1060 | break; |
| 1061 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1062 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1063 | break; |
| 1064 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1065 | } |
| 1066 | |
| 1067 | static void alc_inithook(struct hda_codec *codec) |
| 1068 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1069 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1070 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1071 | } |
| 1072 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1073 | /* additional initialization for ALC888 variants */ |
| 1074 | static void alc888_coef_init(struct hda_codec *codec) |
| 1075 | { |
| 1076 | unsigned int tmp; |
| 1077 | |
| 1078 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1079 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1080 | 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] | 1081 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1082 | /* alc888S-VC */ |
| 1083 | snd_hda_codec_read(codec, 0x20, 0, |
| 1084 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1085 | else |
| 1086 | /* alc888-VB */ |
| 1087 | snd_hda_codec_read(codec, 0x20, 0, |
| 1088 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1089 | } |
| 1090 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1091 | static void alc889_coef_init(struct hda_codec *codec) |
| 1092 | { |
| 1093 | unsigned int tmp; |
| 1094 | |
| 1095 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1096 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1097 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1098 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1099 | } |
| 1100 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1101 | /* turn on/off EAPD control (only if available) */ |
| 1102 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1103 | { |
| 1104 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1105 | return; |
| 1106 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1107 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1108 | on ? 2 : 0); |
| 1109 | } |
| 1110 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1111 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1112 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1113 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1114 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1115 | switch (type) { |
| 1116 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1117 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1118 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1119 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1120 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1121 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1122 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1123 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1124 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1125 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1126 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1127 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1128 | set_eapd(codec, 0x0f, 1); |
| 1129 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1130 | break; |
| 1131 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1132 | case 0x10ec0267: |
| 1133 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1134 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1135 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1136 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1137 | case 0x10ec0660: |
| 1138 | case 0x10ec0662: |
| 1139 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1140 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1141 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1142 | set_eapd(codec, 0x14, 1); |
| 1143 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1144 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1145 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1146 | switch (codec->vendor_id) { |
| 1147 | case 0x10ec0260: |
| 1148 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1149 | AC_VERB_SET_COEF_INDEX, 7); |
| 1150 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1151 | AC_VERB_GET_PROC_COEF, 0); |
| 1152 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1153 | AC_VERB_SET_COEF_INDEX, 7); |
| 1154 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1155 | AC_VERB_SET_PROC_COEF, |
| 1156 | tmp | 0x2010); |
| 1157 | break; |
| 1158 | case 0x10ec0262: |
| 1159 | case 0x10ec0880: |
| 1160 | case 0x10ec0882: |
| 1161 | case 0x10ec0883: |
| 1162 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1163 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1164 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1165 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1166 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1167 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1168 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1169 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1170 | #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] | 1171 | case 0x10ec0267: |
| 1172 | case 0x10ec0268: |
| 1173 | snd_hda_codec_write(codec, 0x20, 0, |
| 1174 | AC_VERB_SET_COEF_INDEX, 7); |
| 1175 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1176 | AC_VERB_GET_PROC_COEF, 0); |
| 1177 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1178 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1179 | snd_hda_codec_write(codec, 0x20, 0, |
| 1180 | AC_VERB_SET_PROC_COEF, |
| 1181 | tmp | 0x3000); |
| 1182 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1183 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1184 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1185 | break; |
| 1186 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1187 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1188 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1189 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1190 | { |
| 1191 | struct alc_spec *spec = codec->spec; |
| 1192 | |
| 1193 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1194 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1195 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1196 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1197 | if (spec->autocfg.line_out_pins[0] && |
| 1198 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1199 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1200 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1201 | else |
| 1202 | return; |
| 1203 | } |
| 1204 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1205 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1206 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1207 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1208 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1209 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1210 | spec->unsol_event = alc_sku_unsol_event; |
| 1211 | } |
| 1212 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1213 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1214 | { |
| 1215 | struct alc_spec *spec = codec->spec; |
| 1216 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1217 | hda_nid_t fixed, ext; |
| 1218 | int i; |
| 1219 | |
| 1220 | /* there must be only two mic inputs exclusively */ |
| 1221 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) |
| 1222 | if (cfg->input_pins[i]) |
| 1223 | return; |
| 1224 | |
| 1225 | fixed = ext = 0; |
| 1226 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { |
| 1227 | hda_nid_t nid = cfg->input_pins[i]; |
| 1228 | unsigned int defcfg; |
| 1229 | if (!nid) |
| 1230 | return; |
| 1231 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1232 | switch (get_defcfg_connect(defcfg)) { |
| 1233 | case AC_JACK_PORT_FIXED: |
| 1234 | if (fixed) |
| 1235 | return; /* already occupied */ |
| 1236 | fixed = nid; |
| 1237 | break; |
| 1238 | case AC_JACK_PORT_COMPLEX: |
| 1239 | if (ext) |
| 1240 | return; /* already occupied */ |
| 1241 | ext = nid; |
| 1242 | break; |
| 1243 | default: |
| 1244 | return; /* invalid entry */ |
| 1245 | } |
| 1246 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1247 | if (!ext || !fixed) |
| 1248 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1249 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1250 | return; /* no unsol support */ |
| 1251 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1252 | ext, fixed); |
| 1253 | spec->ext_mic.pin = ext; |
| 1254 | spec->int_mic.pin = fixed; |
| 1255 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1256 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1257 | spec->auto_mic = 1; |
| 1258 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1259 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1260 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1261 | spec->unsol_event = alc_sku_unsol_event; |
| 1262 | } |
| 1263 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1264 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1265 | { |
| 1266 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1267 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1268 | struct alc_spec *spec = codec->spec; |
| 1269 | |
| 1270 | ass = codec->subsystem_id & 0xffff; |
| 1271 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
| 1272 | goto do_sku; |
| 1273 | |
| 1274 | nid = 0x1d; |
| 1275 | if (codec->vendor_id == 0x10ec0260) |
| 1276 | nid = 0x17; |
| 1277 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1278 | |
| 1279 | if (!(ass & 1)) { |
| 1280 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1281 | codec->chip_name, ass); |
| 1282 | return -1; |
| 1283 | } |
| 1284 | |
| 1285 | /* check sum */ |
| 1286 | tmp = 0; |
| 1287 | for (i = 1; i < 16; i++) { |
| 1288 | if ((ass >> i) & 1) |
| 1289 | tmp++; |
| 1290 | } |
| 1291 | if (((ass >> 16) & 0xf) != tmp) |
| 1292 | return -1; |
| 1293 | |
| 1294 | spec->cdefine.port_connectivity = ass >> 30; |
| 1295 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1296 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1297 | spec->cdefine.customization = ass >> 8; |
| 1298 | do_sku: |
| 1299 | spec->cdefine.sku_cfg = ass; |
| 1300 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1301 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1302 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1303 | spec->cdefine.override = ass & 0x1; |
| 1304 | |
| 1305 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1306 | nid, spec->cdefine.sku_cfg); |
| 1307 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1308 | spec->cdefine.port_connectivity); |
| 1309 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1310 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1311 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1312 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1313 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1314 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1315 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1316 | |
| 1317 | return 0; |
| 1318 | } |
| 1319 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1320 | /* check subsystem ID and set up device-specific initialization; |
| 1321 | * return 1 if initialized, 0 if invalid SSID |
| 1322 | */ |
| 1323 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1324 | * 31 ~ 16 : Manufacture ID |
| 1325 | * 15 ~ 8 : SKU ID |
| 1326 | * 7 ~ 0 : Assembly ID |
| 1327 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1328 | */ |
| 1329 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1330 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1331 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1332 | { |
| 1333 | unsigned int ass, tmp, i; |
| 1334 | unsigned nid; |
| 1335 | struct alc_spec *spec = codec->spec; |
| 1336 | |
| 1337 | ass = codec->subsystem_id & 0xffff; |
| 1338 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1339 | goto do_sku; |
| 1340 | |
| 1341 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1342 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1343 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1344 | * 29~21 : reserve |
| 1345 | * 20 : PCBEEP input |
| 1346 | * 19~16 : Check sum (15:1) |
| 1347 | * 15~1 : Custom |
| 1348 | * 0 : override |
| 1349 | */ |
| 1350 | nid = 0x1d; |
| 1351 | if (codec->vendor_id == 0x10ec0260) |
| 1352 | nid = 0x17; |
| 1353 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1354 | snd_printd("realtek: No valid SSID, " |
| 1355 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1356 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1357 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1358 | return 0; |
| 1359 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1360 | return 0; |
| 1361 | |
| 1362 | /* check sum */ |
| 1363 | tmp = 0; |
| 1364 | for (i = 1; i < 16; i++) { |
| 1365 | if ((ass >> i) & 1) |
| 1366 | tmp++; |
| 1367 | } |
| 1368 | if (((ass >> 16) & 0xf) != tmp) |
| 1369 | return 0; |
| 1370 | do_sku: |
| 1371 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1372 | ass & 0xffff, codec->vendor_id); |
| 1373 | /* |
| 1374 | * 0 : override |
| 1375 | * 1 : Swap Jack |
| 1376 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1377 | * 3~5 : External Amplifier control |
| 1378 | * 7~6 : Reserved |
| 1379 | */ |
| 1380 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1381 | switch (tmp) { |
| 1382 | case 1: |
| 1383 | spec->init_amp = ALC_INIT_GPIO1; |
| 1384 | break; |
| 1385 | case 3: |
| 1386 | spec->init_amp = ALC_INIT_GPIO2; |
| 1387 | break; |
| 1388 | case 7: |
| 1389 | spec->init_amp = ALC_INIT_GPIO3; |
| 1390 | break; |
| 1391 | case 5: |
| 1392 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1393 | break; |
| 1394 | } |
| 1395 | |
| 1396 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1397 | * when the external headphone out jack is plugged" |
| 1398 | */ |
| 1399 | if (!(ass & 0x8000)) |
| 1400 | return 1; |
| 1401 | /* |
| 1402 | * 10~8 : Jack location |
| 1403 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1404 | * 14~13: Resvered |
| 1405 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1406 | * when the external headphone out jack is plugged" |
| 1407 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1408 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1409 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1410 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1411 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1412 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1413 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1414 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1415 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1416 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1417 | else if (tmp == 3) |
| 1418 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1419 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1420 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1421 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1422 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1423 | return 1; |
| 1424 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1425 | } |
| 1426 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1427 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1428 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1429 | return 1; |
| 1430 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1431 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1432 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1433 | hda_nid_t porta, hda_nid_t porte, |
| 1434 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1435 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1436 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1437 | struct alc_spec *spec = codec->spec; |
| 1438 | snd_printd("realtek: " |
| 1439 | "Enable default setup for auto mode as fallback\n"); |
| 1440 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1441 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1442 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1443 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1444 | } |
| 1445 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1446 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1447 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1448 | */ |
| 1449 | |
| 1450 | struct alc_pincfg { |
| 1451 | hda_nid_t nid; |
| 1452 | u32 val; |
| 1453 | }; |
| 1454 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1455 | struct alc_fixup { |
| 1456 | const struct alc_pincfg *pins; |
| 1457 | const struct hda_verb *verbs; |
| 1458 | }; |
| 1459 | |
| 1460 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1461 | const struct snd_pci_quirk *quirk, |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1462 | const struct alc_fixup *fix, |
| 1463 | int pre_init) |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1464 | { |
| 1465 | const struct alc_pincfg *cfg; |
| 1466 | |
| 1467 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1468 | if (!quirk) |
| 1469 | return; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1470 | fix += quirk->value; |
| 1471 | cfg = fix->pins; |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1472 | if (pre_init && cfg) { |
| 1473 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1474 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", |
| 1475 | codec->chip_name, quirk->name); |
| 1476 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1477 | for (; cfg->nid; cfg++) |
| 1478 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
| 1479 | } |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1480 | if (!pre_init && fix->verbs) { |
| 1481 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1482 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", |
| 1483 | codec->chip_name, quirk->name); |
| 1484 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1485 | add_verb(codec->spec, fix->verbs); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1486 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1487 | } |
| 1488 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1489 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1490 | unsigned int coef_idx) |
| 1491 | { |
| 1492 | unsigned int val; |
| 1493 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1494 | coef_idx); |
| 1495 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1496 | AC_VERB_GET_PROC_COEF, 0); |
| 1497 | return val; |
| 1498 | } |
| 1499 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1500 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1501 | * ALC888 |
| 1502 | */ |
| 1503 | |
| 1504 | /* |
| 1505 | * 2ch mode |
| 1506 | */ |
| 1507 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1508 | /* Mic-in jack as mic in */ |
| 1509 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1510 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1511 | /* Line-in jack as Line in */ |
| 1512 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1513 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1514 | /* Line-Out as Front */ |
| 1515 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1516 | { } /* end */ |
| 1517 | }; |
| 1518 | |
| 1519 | /* |
| 1520 | * 4ch mode |
| 1521 | */ |
| 1522 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1523 | /* Mic-in jack as mic in */ |
| 1524 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1525 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1526 | /* Line-in jack as Surround */ |
| 1527 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1528 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1529 | /* Line-Out as Front */ |
| 1530 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1531 | { } /* end */ |
| 1532 | }; |
| 1533 | |
| 1534 | /* |
| 1535 | * 6ch mode |
| 1536 | */ |
| 1537 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1538 | /* Mic-in jack as CLFE */ |
| 1539 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1540 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1541 | /* Line-in jack as Surround */ |
| 1542 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1543 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1544 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1545 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1546 | { } /* end */ |
| 1547 | }; |
| 1548 | |
| 1549 | /* |
| 1550 | * 8ch mode |
| 1551 | */ |
| 1552 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1553 | /* Mic-in jack as CLFE */ |
| 1554 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1555 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1556 | /* Line-in jack as Surround */ |
| 1557 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1558 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1559 | /* Line-Out as Side */ |
| 1560 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1561 | { } /* end */ |
| 1562 | }; |
| 1563 | |
| 1564 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1565 | { 2, alc888_4ST_ch2_intel_init }, |
| 1566 | { 4, alc888_4ST_ch4_intel_init }, |
| 1567 | { 6, alc888_4ST_ch6_intel_init }, |
| 1568 | { 8, alc888_4ST_ch8_intel_init }, |
| 1569 | }; |
| 1570 | |
| 1571 | /* |
| 1572 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1573 | */ |
| 1574 | |
| 1575 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1576 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1577 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1578 | /* Connect Internal HP to Front */ |
| 1579 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1580 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1581 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1582 | /* Connect Bass HP to Front */ |
| 1583 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1584 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1585 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1586 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1587 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1588 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1589 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1590 | /* Connect Mic jack to CLFE */ |
| 1591 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1592 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1593 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1594 | /* Connect Line-in jack to Surround */ |
| 1595 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1596 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1597 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1598 | /* Connect HP out jack to Front */ |
| 1599 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1600 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1601 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1602 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1603 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1604 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1605 | {} |
| 1606 | }; |
| 1607 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1608 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1609 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1610 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1611 | unsigned int mute; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1612 | hda_nid_t nid; |
| 1613 | int i; |
| 1614 | |
| 1615 | spec->jack_present = 0; |
| 1616 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1617 | nid = spec->autocfg.hp_pins[i]; |
| 1618 | if (!nid) |
| 1619 | break; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1620 | if (snd_hda_jack_detect(codec, nid)) { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1621 | spec->jack_present = 1; |
| 1622 | break; |
| 1623 | } |
| 1624 | } |
| 1625 | |
| 1626 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1627 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1628 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1629 | nid = spec->autocfg.speaker_pins[i]; |
| 1630 | if (!nid) |
| 1631 | break; |
| 1632 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1633 | HDA_AMP_MUTE, mute); |
| 1634 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1635 | } |
| 1636 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1637 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1638 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1639 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1640 | if (codec->vendor_id == 0x10ec0880) |
| 1641 | res >>= 28; |
| 1642 | else |
| 1643 | res >>= 26; |
| 1644 | if (res == ALC880_HP_EVENT) |
| 1645 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1646 | } |
| 1647 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1648 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1649 | { |
| 1650 | struct alc_spec *spec = codec->spec; |
| 1651 | |
| 1652 | spec->autocfg.hp_pins[0] = 0x15; |
| 1653 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1654 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1655 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1656 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1657 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1658 | } |
| 1659 | |
| 1660 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1661 | { |
| 1662 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1663 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1664 | } |
| 1665 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1666 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1667 | { |
| 1668 | struct alc_spec *spec = codec->spec; |
| 1669 | |
| 1670 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1671 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1672 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1673 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1674 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1675 | |
| 1676 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1677 | * ALC888 Acer Aspire 4930G model |
| 1678 | */ |
| 1679 | |
| 1680 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1681 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1682 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1683 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1684 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1685 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1686 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1687 | /* Connect Internal HP to front */ |
| 1688 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1689 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1690 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1691 | /* Connect HP out to front */ |
| 1692 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1693 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1694 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1695 | { } |
| 1696 | }; |
| 1697 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1698 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1699 | * ALC888 Acer Aspire 6530G model |
| 1700 | */ |
| 1701 | |
| 1702 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1703 | /* Route to built-in subwoofer as well as speakers */ |
| 1704 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1705 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1706 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1707 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1708 | /* Bias voltage on for external mic port */ |
| 1709 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1710 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1711 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1712 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1713 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1714 | /* Enable unsolicited event for HP jack */ |
| 1715 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1716 | /* Enable speaker output */ |
| 1717 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1718 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1719 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1720 | /* Enable headphone output */ |
| 1721 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1722 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1723 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1724 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1725 | { } |
| 1726 | }; |
| 1727 | |
| 1728 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1729 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1730 | */ |
| 1731 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1732 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1733 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1734 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1735 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1736 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1737 | /* Enable unsolicited event for HP jack */ |
| 1738 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1739 | /* Connect Internal Front to Front */ |
| 1740 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1741 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1742 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1743 | /* Connect Internal Rear to Rear */ |
| 1744 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1745 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1746 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1747 | /* Connect Internal CLFE to CLFE */ |
| 1748 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1749 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1750 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1751 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1752 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1753 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1754 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1755 | /* Enable all DACs */ |
| 1756 | /* DAC DISABLE/MUTE 1? */ |
| 1757 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1758 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1759 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1760 | /* DAC DISABLE/MUTE 2? */ |
| 1761 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1762 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1763 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1764 | /* DMIC fix |
| 1765 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1766 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1767 | * makes the signal become a difference/sum signal instead of standard |
| 1768 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1769 | * codec replicate the sum signal to both channels, turning it into a |
| 1770 | * normal mono mic. |
| 1771 | */ |
| 1772 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1773 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1774 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1775 | { } |
| 1776 | }; |
| 1777 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1778 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1779 | /* Front mic only available on one ADC */ |
| 1780 | { |
| 1781 | .num_items = 4, |
| 1782 | .items = { |
| 1783 | { "Mic", 0x0 }, |
| 1784 | { "Line", 0x2 }, |
| 1785 | { "CD", 0x4 }, |
| 1786 | { "Front Mic", 0xb }, |
| 1787 | }, |
| 1788 | }, |
| 1789 | { |
| 1790 | .num_items = 3, |
| 1791 | .items = { |
| 1792 | { "Mic", 0x0 }, |
| 1793 | { "Line", 0x2 }, |
| 1794 | { "CD", 0x4 }, |
| 1795 | }, |
| 1796 | } |
| 1797 | }; |
| 1798 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1799 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1800 | /* Interal mic only available on one ADC */ |
| 1801 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1802 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1803 | .items = { |
| 1804 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1805 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1806 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1807 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1808 | { "Int Mic", 0xb }, |
| 1809 | }, |
| 1810 | }, |
| 1811 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1812 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1813 | .items = { |
| 1814 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1815 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1816 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1817 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1818 | }, |
| 1819 | } |
| 1820 | }; |
| 1821 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1822 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1823 | /* Digital mic only available on first "ADC" */ |
| 1824 | { |
| 1825 | .num_items = 5, |
| 1826 | .items = { |
| 1827 | { "Mic", 0x0 }, |
| 1828 | { "Line", 0x2 }, |
| 1829 | { "CD", 0x4 }, |
| 1830 | { "Front Mic", 0xb }, |
| 1831 | { "Input Mix", 0xa }, |
| 1832 | }, |
| 1833 | }, |
| 1834 | { |
| 1835 | .num_items = 4, |
| 1836 | .items = { |
| 1837 | { "Mic", 0x0 }, |
| 1838 | { "Line", 0x2 }, |
| 1839 | { "CD", 0x4 }, |
| 1840 | { "Input Mix", 0xa }, |
| 1841 | }, |
| 1842 | }, |
| 1843 | { |
| 1844 | .num_items = 4, |
| 1845 | .items = { |
| 1846 | { "Mic", 0x0 }, |
| 1847 | { "Line", 0x2 }, |
| 1848 | { "CD", 0x4 }, |
| 1849 | { "Input Mix", 0xa }, |
| 1850 | }, |
| 1851 | } |
| 1852 | }; |
| 1853 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1854 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1855 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1856 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1857 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1858 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1859 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1860 | HDA_OUTPUT), |
| 1861 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1862 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1863 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1864 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1865 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1866 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1867 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1868 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1869 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1870 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1871 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1872 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1873 | { } /* end */ |
| 1874 | }; |
| 1875 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 1876 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 1877 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1878 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1879 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1880 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1881 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1882 | HDA_OUTPUT), |
| 1883 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1884 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1885 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1886 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1887 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1888 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1889 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1890 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1891 | { } /* end */ |
| 1892 | }; |
| 1893 | |
| 1894 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1895 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1896 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1897 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1898 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1899 | spec->autocfg.hp_pins[0] = 0x15; |
| 1900 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 1901 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1902 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1903 | } |
| 1904 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1905 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1906 | { |
| 1907 | struct alc_spec *spec = codec->spec; |
| 1908 | |
| 1909 | spec->autocfg.hp_pins[0] = 0x15; |
| 1910 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1911 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1912 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1913 | } |
| 1914 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1915 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1916 | { |
| 1917 | struct alc_spec *spec = codec->spec; |
| 1918 | |
| 1919 | spec->autocfg.hp_pins[0] = 0x15; |
| 1920 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1921 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1922 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1923 | } |
| 1924 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1925 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1926 | * ALC880 3-stack model |
| 1927 | * |
| 1928 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1929 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1930 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1931 | */ |
| 1932 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1933 | static hda_nid_t alc880_dac_nids[4] = { |
| 1934 | /* front, rear, clfe, rear_surr */ |
| 1935 | 0x02, 0x05, 0x04, 0x03 |
| 1936 | }; |
| 1937 | |
| 1938 | static hda_nid_t alc880_adc_nids[3] = { |
| 1939 | /* ADC0-2 */ |
| 1940 | 0x07, 0x08, 0x09, |
| 1941 | }; |
| 1942 | |
| 1943 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1944 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1945 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1946 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1947 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1948 | /* ADC1-2 */ |
| 1949 | 0x08, 0x09, |
| 1950 | }; |
| 1951 | |
| 1952 | #define ALC880_DIGOUT_NID 0x06 |
| 1953 | #define ALC880_DIGIN_NID 0x0a |
| 1954 | |
| 1955 | static struct hda_input_mux alc880_capture_source = { |
| 1956 | .num_items = 4, |
| 1957 | .items = { |
| 1958 | { "Mic", 0x0 }, |
| 1959 | { "Front Mic", 0x3 }, |
| 1960 | { "Line", 0x2 }, |
| 1961 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1962 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1963 | }; |
| 1964 | |
| 1965 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1966 | /* 2ch mode */ |
| 1967 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1968 | /* set line-in to input, mute it */ |
| 1969 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1970 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1971 | /* set mic-in to input vref 80%, mute it */ |
| 1972 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1973 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1974 | { } /* end */ |
| 1975 | }; |
| 1976 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1977 | /* 6ch mode */ |
| 1978 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1979 | /* set line-in to output, unmute it */ |
| 1980 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1981 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1982 | /* set mic-in to output, unmute it */ |
| 1983 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1984 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1985 | { } /* end */ |
| 1986 | }; |
| 1987 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1988 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1989 | { 2, alc880_threestack_ch2_init }, |
| 1990 | { 6, alc880_threestack_ch6_init }, |
| 1991 | }; |
| 1992 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1993 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1994 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1995 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1996 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1997 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1998 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1999 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2000 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2001 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2002 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2003 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2004 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2005 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2006 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2007 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2008 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2009 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2010 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2011 | { |
| 2012 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2013 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2014 | .info = alc_ch_mode_info, |
| 2015 | .get = alc_ch_mode_get, |
| 2016 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2017 | }, |
| 2018 | { } /* end */ |
| 2019 | }; |
| 2020 | |
| 2021 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2022 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2023 | struct snd_ctl_elem_info *uinfo) |
| 2024 | { |
| 2025 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2026 | struct alc_spec *spec = codec->spec; |
| 2027 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2028 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2029 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2030 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2031 | HDA_INPUT); |
| 2032 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2033 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2034 | return err; |
| 2035 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2036 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2037 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2038 | unsigned int size, unsigned int __user *tlv) |
| 2039 | { |
| 2040 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2041 | struct alc_spec *spec = codec->spec; |
| 2042 | int err; |
| 2043 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2044 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2045 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2046 | HDA_INPUT); |
| 2047 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2048 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2049 | return err; |
| 2050 | } |
| 2051 | |
| 2052 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2053 | struct snd_ctl_elem_value *ucontrol); |
| 2054 | |
| 2055 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2056 | struct snd_ctl_elem_value *ucontrol, |
| 2057 | getput_call_t func) |
| 2058 | { |
| 2059 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2060 | struct alc_spec *spec = codec->spec; |
| 2061 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2062 | int err; |
| 2063 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2064 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2065 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2066 | 3, 0, HDA_INPUT); |
| 2067 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2068 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2069 | return err; |
| 2070 | } |
| 2071 | |
| 2072 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2073 | struct snd_ctl_elem_value *ucontrol) |
| 2074 | { |
| 2075 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2076 | snd_hda_mixer_amp_volume_get); |
| 2077 | } |
| 2078 | |
| 2079 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2080 | struct snd_ctl_elem_value *ucontrol) |
| 2081 | { |
| 2082 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2083 | snd_hda_mixer_amp_volume_put); |
| 2084 | } |
| 2085 | |
| 2086 | /* capture mixer elements */ |
| 2087 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2088 | |
| 2089 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2090 | struct snd_ctl_elem_value *ucontrol) |
| 2091 | { |
| 2092 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2093 | snd_hda_mixer_amp_switch_get); |
| 2094 | } |
| 2095 | |
| 2096 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2097 | struct snd_ctl_elem_value *ucontrol) |
| 2098 | { |
| 2099 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2100 | snd_hda_mixer_amp_switch_put); |
| 2101 | } |
| 2102 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2103 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2104 | { \ |
| 2105 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2106 | .name = "Capture Switch", \ |
| 2107 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2108 | .count = num, \ |
| 2109 | .info = alc_cap_sw_info, \ |
| 2110 | .get = alc_cap_sw_get, \ |
| 2111 | .put = alc_cap_sw_put, \ |
| 2112 | }, \ |
| 2113 | { \ |
| 2114 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2115 | .name = "Capture Volume", \ |
| 2116 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2117 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2118 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2119 | .count = num, \ |
| 2120 | .info = alc_cap_vol_info, \ |
| 2121 | .get = alc_cap_vol_get, \ |
| 2122 | .put = alc_cap_vol_put, \ |
| 2123 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2124 | } |
| 2125 | |
| 2126 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2127 | { \ |
| 2128 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2129 | /* .name = "Capture Source", */ \ |
| 2130 | .name = "Input Source", \ |
| 2131 | .count = num, \ |
| 2132 | .info = alc_mux_enum_info, \ |
| 2133 | .get = alc_mux_enum_get, \ |
| 2134 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2135 | } |
| 2136 | |
| 2137 | #define DEFINE_CAPMIX(num) \ |
| 2138 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2139 | _DEFINE_CAPMIX(num), \ |
| 2140 | _DEFINE_CAPSRC(num), \ |
| 2141 | { } /* end */ \ |
| 2142 | } |
| 2143 | |
| 2144 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2145 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2146 | _DEFINE_CAPMIX(num), \ |
| 2147 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2148 | } |
| 2149 | |
| 2150 | /* up to three ADCs */ |
| 2151 | DEFINE_CAPMIX(1); |
| 2152 | DEFINE_CAPMIX(2); |
| 2153 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2154 | DEFINE_CAPMIX_NOSRC(1); |
| 2155 | DEFINE_CAPMIX_NOSRC(2); |
| 2156 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2157 | |
| 2158 | /* |
| 2159 | * ALC880 5-stack model |
| 2160 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2161 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2162 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2163 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2164 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2165 | */ |
| 2166 | |
| 2167 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2168 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2169 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2170 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2171 | { } /* end */ |
| 2172 | }; |
| 2173 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2174 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2175 | /* 6ch mode */ |
| 2176 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2177 | /* set line-in to input, mute it */ |
| 2178 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2179 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2180 | { } /* end */ |
| 2181 | }; |
| 2182 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2183 | /* 8ch mode */ |
| 2184 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2185 | /* set line-in to output, unmute it */ |
| 2186 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2187 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2188 | { } /* end */ |
| 2189 | }; |
| 2190 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2191 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2192 | { 6, alc880_fivestack_ch6_init }, |
| 2193 | { 8, alc880_fivestack_ch8_init }, |
| 2194 | }; |
| 2195 | |
| 2196 | |
| 2197 | /* |
| 2198 | * ALC880 6-stack model |
| 2199 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2200 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2201 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2202 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2203 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2204 | */ |
| 2205 | |
| 2206 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2207 | /* front, rear, clfe, rear_surr */ |
| 2208 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2209 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2210 | |
| 2211 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2212 | .num_items = 4, |
| 2213 | .items = { |
| 2214 | { "Mic", 0x0 }, |
| 2215 | { "Front Mic", 0x1 }, |
| 2216 | { "Line", 0x2 }, |
| 2217 | { "CD", 0x4 }, |
| 2218 | }, |
| 2219 | }; |
| 2220 | |
| 2221 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2222 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2223 | { 8, NULL }, |
| 2224 | }; |
| 2225 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2226 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2227 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2228 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2229 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2230 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2231 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2232 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2233 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2234 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2235 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2236 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2237 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2238 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2239 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2240 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2241 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2242 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2243 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2244 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2245 | { |
| 2246 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2247 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2248 | .info = alc_ch_mode_info, |
| 2249 | .get = alc_ch_mode_get, |
| 2250 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2251 | }, |
| 2252 | { } /* end */ |
| 2253 | }; |
| 2254 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2255 | |
| 2256 | /* |
| 2257 | * ALC880 W810 model |
| 2258 | * |
| 2259 | * W810 has rear IO for: |
| 2260 | * Front (DAC 02) |
| 2261 | * Surround (DAC 03) |
| 2262 | * Center/LFE (DAC 04) |
| 2263 | * Digital out (06) |
| 2264 | * |
| 2265 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2266 | * 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] | 2267 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2268 | * There is a variable resistor to control the speaker or headphone |
| 2269 | * volume. This is a hardware-only device without a software API. |
| 2270 | * |
| 2271 | * Plugging headphones in will disable the internal speakers. This is |
| 2272 | * implemented in hardware, not via the driver using jack sense. In |
| 2273 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2274 | * disable both the speakers and headphones. |
| 2275 | * |
| 2276 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2277 | * These may not do anything useful with this driver yet, because I |
| 2278 | * haven't setup any initialization verbs for these yet... |
| 2279 | */ |
| 2280 | |
| 2281 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2282 | /* front, rear/surround, clfe */ |
| 2283 | 0x02, 0x03, 0x04 |
| 2284 | }; |
| 2285 | |
| 2286 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2287 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2288 | { 6, NULL } |
| 2289 | }; |
| 2290 | |
| 2291 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2292 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2293 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2294 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2295 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2296 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2297 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2298 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2299 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2300 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2301 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2302 | { } /* end */ |
| 2303 | }; |
| 2304 | |
| 2305 | |
| 2306 | /* |
| 2307 | * Z710V model |
| 2308 | * |
| 2309 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2310 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2311 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2312 | */ |
| 2313 | |
| 2314 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2315 | 0x02 |
| 2316 | }; |
| 2317 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2318 | |
| 2319 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2320 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2321 | { 2, NULL } |
| 2322 | }; |
| 2323 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2324 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2325 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2326 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2327 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2328 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2329 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2330 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2331 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2332 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2333 | { } /* end */ |
| 2334 | }; |
| 2335 | |
| 2336 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2337 | /* |
| 2338 | * ALC880 F1734 model |
| 2339 | * |
| 2340 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2341 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2342 | */ |
| 2343 | |
| 2344 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2345 | 0x03 |
| 2346 | }; |
| 2347 | #define ALC880_F1734_HP_DAC 0x02 |
| 2348 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2349 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2350 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2351 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2352 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2353 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2354 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2355 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2356 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2357 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2358 | { } /* end */ |
| 2359 | }; |
| 2360 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2361 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2362 | .num_items = 2, |
| 2363 | .items = { |
| 2364 | { "Mic", 0x1 }, |
| 2365 | { "CD", 0x4 }, |
| 2366 | }, |
| 2367 | }; |
| 2368 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2369 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2370 | /* |
| 2371 | * ALC880 ASUS model |
| 2372 | * |
| 2373 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2374 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2375 | * Mic = 0x18, Line = 0x1a |
| 2376 | */ |
| 2377 | |
| 2378 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2379 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2380 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2381 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2382 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2383 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2384 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2385 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2386 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2387 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2388 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2389 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2390 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2391 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2392 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2393 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2394 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2395 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2396 | { |
| 2397 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2398 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2399 | .info = alc_ch_mode_info, |
| 2400 | .get = alc_ch_mode_get, |
| 2401 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2402 | }, |
| 2403 | { } /* end */ |
| 2404 | }; |
| 2405 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2406 | /* |
| 2407 | * ALC880 ASUS W1V model |
| 2408 | * |
| 2409 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2410 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2411 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2412 | */ |
| 2413 | |
| 2414 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2415 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2416 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2417 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2418 | { } /* end */ |
| 2419 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2420 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2421 | /* TCL S700 */ |
| 2422 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2423 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2424 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2425 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2426 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2427 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2428 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2429 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2430 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2431 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2432 | { } /* end */ |
| 2433 | }; |
| 2434 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2435 | /* Uniwill */ |
| 2436 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2437 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2438 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2439 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2440 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2441 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2442 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2443 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2444 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2445 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2446 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2447 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2448 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2449 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2450 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2451 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2452 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2453 | { |
| 2454 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2455 | .name = "Channel Mode", |
| 2456 | .info = alc_ch_mode_info, |
| 2457 | .get = alc_ch_mode_get, |
| 2458 | .put = alc_ch_mode_put, |
| 2459 | }, |
| 2460 | { } /* end */ |
| 2461 | }; |
| 2462 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2463 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2464 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2465 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2466 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2467 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2468 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2469 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2470 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2471 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2472 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2473 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2474 | { } /* end */ |
| 2475 | }; |
| 2476 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2477 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2478 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2479 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2480 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2481 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2482 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2483 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2484 | { } /* end */ |
| 2485 | }; |
| 2486 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2487 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2488 | * virtual master controls |
| 2489 | */ |
| 2490 | |
| 2491 | /* |
| 2492 | * slave controls for virtual master |
| 2493 | */ |
| 2494 | static const char *alc_slave_vols[] = { |
| 2495 | "Front Playback Volume", |
| 2496 | "Surround Playback Volume", |
| 2497 | "Center Playback Volume", |
| 2498 | "LFE Playback Volume", |
| 2499 | "Side Playback Volume", |
| 2500 | "Headphone Playback Volume", |
| 2501 | "Speaker Playback Volume", |
| 2502 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2503 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2504 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2505 | NULL, |
| 2506 | }; |
| 2507 | |
| 2508 | static const char *alc_slave_sws[] = { |
| 2509 | "Front Playback Switch", |
| 2510 | "Surround Playback Switch", |
| 2511 | "Center Playback Switch", |
| 2512 | "LFE Playback Switch", |
| 2513 | "Side Playback Switch", |
| 2514 | "Headphone Playback Switch", |
| 2515 | "Speaker Playback Switch", |
| 2516 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2517 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2518 | "Line-Out Playback Switch", |
| 2519 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2520 | NULL, |
| 2521 | }; |
| 2522 | |
| 2523 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2524 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2525 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2526 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2527 | #define NID_MAPPING (-1) |
| 2528 | |
| 2529 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2530 | #define SUBDEV_HP_ (1 << 6) |
| 2531 | #define SUBDEV_LINE_ (2 << 6) |
| 2532 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2533 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2534 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2535 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2536 | static void alc_free_kctls(struct hda_codec *codec); |
| 2537 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2538 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2539 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2540 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2541 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2542 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2543 | { } /* end */ |
| 2544 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2545 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2546 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2547 | static int alc_build_controls(struct hda_codec *codec) |
| 2548 | { |
| 2549 | struct alc_spec *spec = codec->spec; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2550 | struct snd_kcontrol *kctl; |
| 2551 | struct snd_kcontrol_new *knew; |
| 2552 | int i, j, err; |
| 2553 | unsigned int u; |
| 2554 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2555 | |
| 2556 | for (i = 0; i < spec->num_mixers; i++) { |
| 2557 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2558 | if (err < 0) |
| 2559 | return err; |
| 2560 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2561 | if (spec->cap_mixer) { |
| 2562 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2563 | if (err < 0) |
| 2564 | return err; |
| 2565 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2566 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2567 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2568 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2569 | if (err < 0) |
| 2570 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2571 | if (!spec->no_analog) { |
| 2572 | err = snd_hda_create_spdif_share_sw(codec, |
| 2573 | &spec->multiout); |
| 2574 | if (err < 0) |
| 2575 | return err; |
| 2576 | spec->multiout.share_spdif = 1; |
| 2577 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2578 | } |
| 2579 | if (spec->dig_in_nid) { |
| 2580 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2581 | if (err < 0) |
| 2582 | return err; |
| 2583 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2584 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2585 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2586 | /* create beep controls if needed */ |
| 2587 | if (spec->beep_amp) { |
| 2588 | struct snd_kcontrol_new *knew; |
| 2589 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2590 | struct snd_kcontrol *kctl; |
| 2591 | kctl = snd_ctl_new1(knew, codec); |
| 2592 | if (!kctl) |
| 2593 | return -ENOMEM; |
| 2594 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2595 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2596 | if (err < 0) |
| 2597 | return err; |
| 2598 | } |
| 2599 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2600 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2601 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2602 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2603 | if (!spec->no_analog && |
| 2604 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2605 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2606 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2607 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2608 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2609 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2610 | if (err < 0) |
| 2611 | return err; |
| 2612 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2613 | if (!spec->no_analog && |
| 2614 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2615 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2616 | NULL, alc_slave_sws); |
| 2617 | if (err < 0) |
| 2618 | return err; |
| 2619 | } |
| 2620 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2621 | /* assign Capture Source enums to NID */ |
| 2622 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 2623 | if (!kctl) |
| 2624 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 2625 | for (i = 0; kctl && i < kctl->count; i++) { |
Takashi Iwai | d1409ae | 2009-12-17 15:01:31 +0100 | [diff] [blame] | 2626 | hda_nid_t *nids = spec->capsrc_nids; |
| 2627 | if (!nids) |
| 2628 | nids = spec->adc_nids; |
Takashi Iwai | 21949f0 | 2009-12-23 08:31:59 +0100 | [diff] [blame] | 2629 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2630 | if (err < 0) |
| 2631 | return err; |
| 2632 | } |
| 2633 | if (spec->cap_mixer) { |
| 2634 | const char *kname = kctl ? kctl->id.name : NULL; |
| 2635 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 2636 | if (kname && strcmp(knew->name, kname) == 0) |
| 2637 | continue; |
| 2638 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2639 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2640 | err = snd_hda_add_nid(codec, kctl, i, |
| 2641 | spec->adc_nids[i]); |
| 2642 | if (err < 0) |
| 2643 | return err; |
| 2644 | } |
| 2645 | } |
| 2646 | } |
| 2647 | |
| 2648 | /* other nid->control mapping */ |
| 2649 | for (i = 0; i < spec->num_mixers; i++) { |
| 2650 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 2651 | if (knew->iface != NID_MAPPING) |
| 2652 | continue; |
| 2653 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2654 | if (kctl == NULL) |
| 2655 | continue; |
| 2656 | u = knew->subdevice; |
| 2657 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2658 | nid = u & 0x3f; |
| 2659 | if (nid == 0) |
| 2660 | continue; |
| 2661 | switch (u & 0xc0) { |
| 2662 | case SUBDEV_SPEAKER_: |
| 2663 | nid = spec->autocfg.speaker_pins[nid]; |
| 2664 | break; |
| 2665 | case SUBDEV_LINE_: |
| 2666 | nid = spec->autocfg.line_out_pins[nid]; |
| 2667 | break; |
| 2668 | case SUBDEV_HP_: |
| 2669 | nid = spec->autocfg.hp_pins[nid]; |
| 2670 | break; |
| 2671 | default: |
| 2672 | continue; |
| 2673 | } |
| 2674 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2675 | if (err < 0) |
| 2676 | return err; |
| 2677 | } |
| 2678 | u = knew->private_value; |
| 2679 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2680 | nid = u & 0xff; |
| 2681 | if (nid == 0) |
| 2682 | continue; |
| 2683 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2684 | if (err < 0) |
| 2685 | return err; |
| 2686 | } |
| 2687 | } |
| 2688 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 2689 | |
| 2690 | alc_free_kctls(codec); /* no longer needed */ |
| 2691 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2692 | return 0; |
| 2693 | } |
| 2694 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2695 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2696 | /* |
| 2697 | * initialize the codec volumes, etc |
| 2698 | */ |
| 2699 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2700 | /* |
| 2701 | * generic initialization of ADC, input mixers and output mixers |
| 2702 | */ |
| 2703 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2704 | /* |
| 2705 | * Unmute ADC0-2 and set the default input to mic-in |
| 2706 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2707 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2708 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2709 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2710 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2711 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2712 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2713 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2714 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2715 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2716 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2717 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2718 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2719 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2720 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2721 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2722 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2723 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2724 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2725 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2726 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2727 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2728 | /* |
| 2729 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2730 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2731 | /* set vol=0 to output mixers */ |
| 2732 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2733 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2734 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2735 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2736 | /* set up input amps for analog loopback */ |
| 2737 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2738 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2739 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2740 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2741 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2742 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2743 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2744 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2745 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2746 | |
| 2747 | { } |
| 2748 | }; |
| 2749 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2750 | /* |
| 2751 | * 3-stack pin configuration: |
| 2752 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2753 | */ |
| 2754 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2755 | /* |
| 2756 | * preset connection lists of input pins |
| 2757 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2758 | */ |
| 2759 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2760 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2761 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2762 | |
| 2763 | /* |
| 2764 | * Set pin mode and muting |
| 2765 | */ |
| 2766 | /* set front pin widgets 0x14 for output */ |
| 2767 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2768 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2769 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2770 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2771 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2772 | /* Mic2 (as headphone out) for HP output */ |
| 2773 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2774 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2775 | /* Line In pin widget for input */ |
| 2776 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2777 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2778 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2779 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2780 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2781 | /* CD pin widget for input */ |
| 2782 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2783 | |
| 2784 | { } |
| 2785 | }; |
| 2786 | |
| 2787 | /* |
| 2788 | * 5-stack pin configuration: |
| 2789 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2790 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2791 | */ |
| 2792 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2793 | /* |
| 2794 | * preset connection lists of input pins |
| 2795 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2796 | */ |
| 2797 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2798 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2799 | |
| 2800 | /* |
| 2801 | * Set pin mode and muting |
| 2802 | */ |
| 2803 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2804 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2805 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2806 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2807 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2808 | /* unmute pins for output (no gain on this amp) */ |
| 2809 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2810 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2811 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2812 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2813 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2814 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2815 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2816 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2817 | /* Mic2 (as headphone out) for HP output */ |
| 2818 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2819 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2820 | /* Line In pin widget for input */ |
| 2821 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2822 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2823 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2824 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2825 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2826 | /* CD pin widget for input */ |
| 2827 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2828 | |
| 2829 | { } |
| 2830 | }; |
| 2831 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2832 | /* |
| 2833 | * W810 pin configuration: |
| 2834 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2835 | */ |
| 2836 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2837 | /* hphone/speaker input selector: front DAC */ |
| 2838 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2839 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2840 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2841 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2842 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2843 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2844 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2845 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2846 | |
| 2847 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2848 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2849 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2850 | { } |
| 2851 | }; |
| 2852 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2853 | /* |
| 2854 | * Z71V pin configuration: |
| 2855 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2856 | */ |
| 2857 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2858 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2859 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2860 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2861 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2862 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2863 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2864 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2865 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2866 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2867 | |
| 2868 | { } |
| 2869 | }; |
| 2870 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2871 | /* |
| 2872 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2873 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2874 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2875 | */ |
| 2876 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2877 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2878 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2879 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2880 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2881 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2882 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2883 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2884 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2885 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2886 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2887 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2888 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2889 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2890 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2891 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2892 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2893 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2894 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2895 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2896 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2897 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2898 | { } |
| 2899 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2900 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2901 | /* |
| 2902 | * Uniwill pin configuration: |
| 2903 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2904 | * line = 0x1a |
| 2905 | */ |
| 2906 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2907 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2908 | |
| 2909 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2910 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2911 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2912 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2913 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2914 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2915 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2916 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2917 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2918 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2919 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2920 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2921 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2922 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2923 | |
| 2924 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2925 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2926 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2927 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2928 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2929 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2930 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2931 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2932 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2933 | |
| 2934 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2935 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2936 | |
| 2937 | { } |
| 2938 | }; |
| 2939 | |
| 2940 | /* |
| 2941 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2942 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2943 | */ |
| 2944 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2945 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2946 | |
| 2947 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2948 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2949 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2950 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2951 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2952 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2953 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2954 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2955 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2956 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2957 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2958 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2959 | |
| 2960 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2961 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2962 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2963 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2964 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2965 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2966 | |
| 2967 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2968 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2969 | |
| 2970 | { } |
| 2971 | }; |
| 2972 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2973 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2974 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2975 | { } |
| 2976 | }; |
| 2977 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2978 | /* auto-toggle front mic */ |
| 2979 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2980 | { |
| 2981 | unsigned int present; |
| 2982 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2983 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 2984 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2985 | bits = present ? HDA_AMP_MUTE : 0; |
| 2986 | 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] | 2987 | } |
| 2988 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2989 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2990 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2991 | struct alc_spec *spec = codec->spec; |
| 2992 | |
| 2993 | spec->autocfg.hp_pins[0] = 0x14; |
| 2994 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2995 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2996 | } |
| 2997 | |
| 2998 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 2999 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3000 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3001 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3002 | } |
| 3003 | |
| 3004 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3005 | unsigned int res) |
| 3006 | { |
| 3007 | /* Looks like the unsol event is incompatible with the standard |
| 3008 | * definition. 4bit tag is placed at 28 bit! |
| 3009 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3010 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3011 | case ALC880_MIC_EVENT: |
| 3012 | alc880_uniwill_mic_automute(codec); |
| 3013 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3014 | default: |
| 3015 | alc_automute_amp_unsol_event(codec, res); |
| 3016 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3017 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3018 | } |
| 3019 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3020 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3021 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3022 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3023 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3024 | spec->autocfg.hp_pins[0] = 0x14; |
| 3025 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3026 | } |
| 3027 | |
| 3028 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3029 | { |
| 3030 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3031 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3032 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3033 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3034 | present &= HDA_AMP_VOLMASK; |
| 3035 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3036 | HDA_AMP_VOLMASK, present); |
| 3037 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3038 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3039 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3040 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3041 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3042 | unsigned int res) |
| 3043 | { |
| 3044 | /* Looks like the unsol event is incompatible with the standard |
| 3045 | * definition. 4bit tag is placed at 28 bit! |
| 3046 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3047 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3048 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3049 | else |
| 3050 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3051 | } |
| 3052 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3053 | /* |
| 3054 | * F1734 pin configuration: |
| 3055 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3056 | */ |
| 3057 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3058 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3059 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3060 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3061 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3062 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3063 | |
| 3064 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3065 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3066 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3067 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3068 | |
| 3069 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3070 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3071 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3072 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3073 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3074 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3075 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3076 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3077 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3078 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3079 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3080 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3081 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3082 | { } |
| 3083 | }; |
| 3084 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3085 | /* |
| 3086 | * ASUS pin configuration: |
| 3087 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3088 | */ |
| 3089 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3090 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3091 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3092 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3093 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3094 | |
| 3095 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3096 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3097 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3098 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3099 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3100 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3101 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3102 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3103 | |
| 3104 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3105 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3106 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3107 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3108 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3109 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3110 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3111 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3112 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3113 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3114 | { } |
| 3115 | }; |
| 3116 | |
| 3117 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3118 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3119 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3120 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3121 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3122 | /* Clevo m520g init */ |
| 3123 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3124 | /* headphone output */ |
| 3125 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3126 | /* line-out */ |
| 3127 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3128 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3129 | /* Line-in */ |
| 3130 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3131 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3132 | /* CD */ |
| 3133 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3134 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3135 | /* Mic1 (rear panel) */ |
| 3136 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3137 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3138 | /* Mic2 (front panel) */ |
| 3139 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3140 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3141 | /* headphone */ |
| 3142 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3143 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3144 | /* change to EAPD mode */ |
| 3145 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3146 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3147 | |
| 3148 | { } |
| 3149 | }; |
| 3150 | |
| 3151 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3152 | /* change to EAPD mode */ |
| 3153 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3154 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3155 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3156 | /* Headphone output */ |
| 3157 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3158 | /* Front output*/ |
| 3159 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3160 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3161 | |
| 3162 | /* Line In pin widget for input */ |
| 3163 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3164 | /* CD pin widget for input */ |
| 3165 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3166 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3167 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3168 | |
| 3169 | /* change to EAPD mode */ |
| 3170 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3171 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3172 | |
| 3173 | { } |
| 3174 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3175 | |
| 3176 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3177 | * LG m1 express dual |
| 3178 | * |
| 3179 | * Pin assignment: |
| 3180 | * Rear Line-In/Out (blue): 0x14 |
| 3181 | * Build-in Mic-In: 0x15 |
| 3182 | * Speaker-out: 0x17 |
| 3183 | * HP-Out (green): 0x1b |
| 3184 | * Mic-In/Out (red): 0x19 |
| 3185 | * SPDIF-Out: 0x1e |
| 3186 | */ |
| 3187 | |
| 3188 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3189 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3190 | 0x05, 0x02, 0x03 |
| 3191 | }; |
| 3192 | |
| 3193 | /* seems analog CD is not working */ |
| 3194 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3195 | .num_items = 3, |
| 3196 | .items = { |
| 3197 | { "Mic", 0x1 }, |
| 3198 | { "Line", 0x5 }, |
| 3199 | { "Internal Mic", 0x6 }, |
| 3200 | }, |
| 3201 | }; |
| 3202 | |
| 3203 | /* 2,4,6 channel modes */ |
| 3204 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3205 | /* set line-in and mic-in to input */ |
| 3206 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3207 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3208 | { } |
| 3209 | }; |
| 3210 | |
| 3211 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3212 | /* set line-in to out and mic-in to input */ |
| 3213 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3214 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3215 | { } |
| 3216 | }; |
| 3217 | |
| 3218 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3219 | /* set line-in and mic-in to output */ |
| 3220 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3221 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3222 | { } |
| 3223 | }; |
| 3224 | |
| 3225 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3226 | { 2, alc880_lg_ch2_init }, |
| 3227 | { 4, alc880_lg_ch4_init }, |
| 3228 | { 6, alc880_lg_ch6_init }, |
| 3229 | }; |
| 3230 | |
| 3231 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3232 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3233 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3234 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3235 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3236 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3237 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3238 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3239 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3240 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3241 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3242 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3243 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3244 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3245 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3246 | { |
| 3247 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3248 | .name = "Channel Mode", |
| 3249 | .info = alc_ch_mode_info, |
| 3250 | .get = alc_ch_mode_get, |
| 3251 | .put = alc_ch_mode_put, |
| 3252 | }, |
| 3253 | { } /* end */ |
| 3254 | }; |
| 3255 | |
| 3256 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3257 | /* set capture source to mic-in */ |
| 3258 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3259 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3260 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3261 | /* mute all amp mixer inputs */ |
| 3262 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3263 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3264 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3265 | /* line-in to input */ |
| 3266 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3267 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3268 | /* built-in mic */ |
| 3269 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3270 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3271 | /* speaker-out */ |
| 3272 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3273 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3274 | /* mic-in to input */ |
| 3275 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3276 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3277 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3278 | /* HP-out */ |
| 3279 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3280 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3281 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3282 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3283 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3284 | { } |
| 3285 | }; |
| 3286 | |
| 3287 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3288 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3289 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3290 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3291 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3292 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3293 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3294 | } |
| 3295 | |
| 3296 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3297 | * LG LW20 |
| 3298 | * |
| 3299 | * Pin assignment: |
| 3300 | * Speaker-out: 0x14 |
| 3301 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3302 | * Built-in Mic-In: 0x19 |
| 3303 | * Line-In: 0x1b |
| 3304 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3305 | * SPDIF-Out: 0x1e |
| 3306 | */ |
| 3307 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3308 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3309 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3310 | .items = { |
| 3311 | { "Mic", 0x0 }, |
| 3312 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3313 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3314 | }, |
| 3315 | }; |
| 3316 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3317 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3318 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3319 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3320 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3321 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3322 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3323 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3324 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3325 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3326 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3327 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3328 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3329 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3330 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3331 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3332 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3333 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3334 | { |
| 3335 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3336 | .name = "Channel Mode", |
| 3337 | .info = alc_ch_mode_info, |
| 3338 | .get = alc_ch_mode_get, |
| 3339 | .put = alc_ch_mode_put, |
| 3340 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3341 | { } /* end */ |
| 3342 | }; |
| 3343 | |
| 3344 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3345 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3346 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3347 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3348 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3349 | /* set capture source to mic-in */ |
| 3350 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3351 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3352 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3353 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3354 | /* speaker-out */ |
| 3355 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3356 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3357 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3358 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3359 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3360 | /* mic-in to input */ |
| 3361 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3362 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3363 | /* built-in mic */ |
| 3364 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3365 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3366 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3367 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3368 | { } |
| 3369 | }; |
| 3370 | |
| 3371 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3372 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3373 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3374 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3375 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3376 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3377 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3378 | } |
| 3379 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3380 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3381 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3382 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3383 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3384 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3385 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3386 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3387 | { } /* end */ |
| 3388 | }; |
| 3389 | |
| 3390 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3391 | .num_items = 2, |
| 3392 | .items = { |
| 3393 | { "Mic", 0x0 }, |
| 3394 | { "Internal Mic", 0x1 }, |
| 3395 | }, |
| 3396 | }; |
| 3397 | |
| 3398 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3399 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3400 | |
| 3401 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3402 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3403 | |
| 3404 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3405 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3406 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3407 | /* Mic2 (as headphone out) for HP output */ |
| 3408 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3409 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3410 | /* Internal Speaker */ |
| 3411 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3412 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3413 | |
| 3414 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3415 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3416 | |
| 3417 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3418 | { } |
| 3419 | }; |
| 3420 | |
| 3421 | /* toggle speaker-output according to the hp-jack state */ |
| 3422 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3423 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3424 | struct alc_spec *spec = codec->spec; |
| 3425 | alc_automute_amp(codec); |
| 3426 | /* toggle EAPD */ |
| 3427 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3428 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3429 | else |
| 3430 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3431 | } |
| 3432 | |
| 3433 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3434 | unsigned int res) |
| 3435 | { |
| 3436 | /* Looks like the unsol event is incompatible with the standard |
| 3437 | * definition. 4bit tag is placed at 28 bit! |
| 3438 | */ |
| 3439 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3440 | alc880_medion_rim_automute(codec); |
| 3441 | } |
| 3442 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3443 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3444 | { |
| 3445 | struct alc_spec *spec = codec->spec; |
| 3446 | |
| 3447 | spec->autocfg.hp_pins[0] = 0x14; |
| 3448 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3449 | } |
| 3450 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3451 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3452 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3453 | { 0x0b, HDA_INPUT, 0 }, |
| 3454 | { 0x0b, HDA_INPUT, 1 }, |
| 3455 | { 0x0b, HDA_INPUT, 2 }, |
| 3456 | { 0x0b, HDA_INPUT, 3 }, |
| 3457 | { 0x0b, HDA_INPUT, 4 }, |
| 3458 | { } /* end */ |
| 3459 | }; |
| 3460 | |
| 3461 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3462 | { 0x0b, HDA_INPUT, 1 }, |
| 3463 | { 0x0b, HDA_INPUT, 6 }, |
| 3464 | { 0x0b, HDA_INPUT, 7 }, |
| 3465 | { } /* end */ |
| 3466 | }; |
| 3467 | #endif |
| 3468 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3469 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3470 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3471 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3472 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3473 | static int alc_init(struct hda_codec *codec) |
| 3474 | { |
| 3475 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3476 | unsigned int i; |
| 3477 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3478 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3479 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3480 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3481 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3482 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3483 | |
| 3484 | if (spec->init_hook) |
| 3485 | spec->init_hook(codec); |
| 3486 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 3487 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3488 | if (codec->patch_ops.check_power_status) |
| 3489 | codec->patch_ops.check_power_status(codec, 0x01); |
| 3490 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3491 | return 0; |
| 3492 | } |
| 3493 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3494 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3495 | { |
| 3496 | struct alc_spec *spec = codec->spec; |
| 3497 | |
| 3498 | if (spec->unsol_event) |
| 3499 | spec->unsol_event(codec, res); |
| 3500 | } |
| 3501 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3502 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3503 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3504 | { |
| 3505 | struct alc_spec *spec = codec->spec; |
| 3506 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3507 | } |
| 3508 | #endif |
| 3509 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3510 | /* |
| 3511 | * Analog playback callbacks |
| 3512 | */ |
| 3513 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3514 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3515 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3516 | { |
| 3517 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3518 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3519 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3520 | } |
| 3521 | |
| 3522 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3523 | struct hda_codec *codec, |
| 3524 | unsigned int stream_tag, |
| 3525 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3526 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3527 | { |
| 3528 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3529 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3530 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3531 | } |
| 3532 | |
| 3533 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3534 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3535 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3536 | { |
| 3537 | struct alc_spec *spec = codec->spec; |
| 3538 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3539 | } |
| 3540 | |
| 3541 | /* |
| 3542 | * Digital out |
| 3543 | */ |
| 3544 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3545 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3546 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3547 | { |
| 3548 | struct alc_spec *spec = codec->spec; |
| 3549 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3550 | } |
| 3551 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3552 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3553 | struct hda_codec *codec, |
| 3554 | unsigned int stream_tag, |
| 3555 | unsigned int format, |
| 3556 | struct snd_pcm_substream *substream) |
| 3557 | { |
| 3558 | struct alc_spec *spec = codec->spec; |
| 3559 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3560 | stream_tag, format, substream); |
| 3561 | } |
| 3562 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3563 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3564 | struct hda_codec *codec, |
| 3565 | struct snd_pcm_substream *substream) |
| 3566 | { |
| 3567 | struct alc_spec *spec = codec->spec; |
| 3568 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3569 | } |
| 3570 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3571 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3572 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3573 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3574 | { |
| 3575 | struct alc_spec *spec = codec->spec; |
| 3576 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3577 | } |
| 3578 | |
| 3579 | /* |
| 3580 | * Analog capture |
| 3581 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3582 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3583 | struct hda_codec *codec, |
| 3584 | unsigned int stream_tag, |
| 3585 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3586 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3587 | { |
| 3588 | struct alc_spec *spec = codec->spec; |
| 3589 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3590 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3591 | stream_tag, 0, format); |
| 3592 | return 0; |
| 3593 | } |
| 3594 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3595 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3596 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3597 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3598 | { |
| 3599 | struct alc_spec *spec = codec->spec; |
| 3600 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3601 | snd_hda_codec_cleanup_stream(codec, |
| 3602 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3603 | return 0; |
| 3604 | } |
| 3605 | |
| 3606 | |
| 3607 | /* |
| 3608 | */ |
| 3609 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3610 | .substreams = 1, |
| 3611 | .channels_min = 2, |
| 3612 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3613 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3614 | .ops = { |
| 3615 | .open = alc880_playback_pcm_open, |
| 3616 | .prepare = alc880_playback_pcm_prepare, |
| 3617 | .cleanup = alc880_playback_pcm_cleanup |
| 3618 | }, |
| 3619 | }; |
| 3620 | |
| 3621 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3622 | .substreams = 1, |
| 3623 | .channels_min = 2, |
| 3624 | .channels_max = 2, |
| 3625 | /* NID is set in alc_build_pcms */ |
| 3626 | }; |
| 3627 | |
| 3628 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3629 | .substreams = 1, |
| 3630 | .channels_min = 2, |
| 3631 | .channels_max = 2, |
| 3632 | /* NID is set in alc_build_pcms */ |
| 3633 | }; |
| 3634 | |
| 3635 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3636 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3637 | .channels_min = 2, |
| 3638 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3639 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3640 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3641 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3642 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3643 | }, |
| 3644 | }; |
| 3645 | |
| 3646 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3647 | .substreams = 1, |
| 3648 | .channels_min = 2, |
| 3649 | .channels_max = 2, |
| 3650 | /* NID is set in alc_build_pcms */ |
| 3651 | .ops = { |
| 3652 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3653 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3654 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3655 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3656 | }, |
| 3657 | }; |
| 3658 | |
| 3659 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3660 | .substreams = 1, |
| 3661 | .channels_min = 2, |
| 3662 | .channels_max = 2, |
| 3663 | /* NID is set in alc_build_pcms */ |
| 3664 | }; |
| 3665 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3666 | /* 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] | 3667 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3668 | .substreams = 0, |
| 3669 | .channels_min = 0, |
| 3670 | .channels_max = 0, |
| 3671 | }; |
| 3672 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3673 | static int alc_build_pcms(struct hda_codec *codec) |
| 3674 | { |
| 3675 | struct alc_spec *spec = codec->spec; |
| 3676 | struct hda_pcm *info = spec->pcm_rec; |
| 3677 | int i; |
| 3678 | |
| 3679 | codec->num_pcms = 1; |
| 3680 | codec->pcm_info = info; |
| 3681 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3682 | if (spec->no_analog) |
| 3683 | goto skip_analog; |
| 3684 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3685 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3686 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3687 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 3688 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3689 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3690 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3691 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3692 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3693 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3694 | } |
| 3695 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3696 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3697 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3698 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3699 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3700 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3701 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3702 | if (spec->channel_mode) { |
| 3703 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3704 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3705 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3706 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3707 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3708 | } |
| 3709 | } |
| 3710 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3711 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3712 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3713 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3714 | snprintf(spec->stream_name_digital, |
| 3715 | sizeof(spec->stream_name_digital), |
| 3716 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3717 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3718 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3719 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3720 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3721 | if (spec->dig_out_type) |
| 3722 | info->pcm_type = spec->dig_out_type; |
| 3723 | else |
| 3724 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3725 | if (spec->multiout.dig_out_nid && |
| 3726 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3727 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3728 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3729 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3730 | if (spec->dig_in_nid && |
| 3731 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3732 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3733 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3734 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3735 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3736 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3737 | } |
| 3738 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3739 | if (spec->no_analog) |
| 3740 | return 0; |
| 3741 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3742 | /* If the use of more than one ADC is requested for the current |
| 3743 | * model, configure a second analog capture-only PCM. |
| 3744 | */ |
| 3745 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3746 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3747 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3748 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3749 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3750 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3751 | if (spec->alt_dac_nid) { |
| 3752 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3753 | *spec->stream_analog_alt_playback; |
| 3754 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3755 | spec->alt_dac_nid; |
| 3756 | } else { |
| 3757 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3758 | alc_pcm_null_stream; |
| 3759 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3760 | } |
| 3761 | if (spec->num_adc_nids > 1) { |
| 3762 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3763 | *spec->stream_analog_alt_capture; |
| 3764 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3765 | spec->adc_nids[1]; |
| 3766 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3767 | spec->num_adc_nids - 1; |
| 3768 | } else { |
| 3769 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3770 | alc_pcm_null_stream; |
| 3771 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3772 | } |
| 3773 | } |
| 3774 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3775 | return 0; |
| 3776 | } |
| 3777 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3778 | static inline void alc_shutup(struct hda_codec *codec) |
| 3779 | { |
| 3780 | snd_hda_shutup_pins(codec); |
| 3781 | } |
| 3782 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3783 | static void alc_free_kctls(struct hda_codec *codec) |
| 3784 | { |
| 3785 | struct alc_spec *spec = codec->spec; |
| 3786 | |
| 3787 | if (spec->kctls.list) { |
| 3788 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3789 | int i; |
| 3790 | for (i = 0; i < spec->kctls.used; i++) |
| 3791 | kfree(kctl[i].name); |
| 3792 | } |
| 3793 | snd_array_free(&spec->kctls); |
| 3794 | } |
| 3795 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3796 | static void alc_free(struct hda_codec *codec) |
| 3797 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3798 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3799 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3800 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3801 | return; |
| 3802 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3803 | alc_shutup(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3804 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3805 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3806 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3807 | } |
| 3808 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3809 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3810 | static void alc_power_eapd(struct hda_codec *codec) |
| 3811 | { |
| 3812 | /* We currently only handle front, HP */ |
| 3813 | switch (codec->vendor_id) { |
| 3814 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3815 | set_eapd(codec, 0x0f, 0); |
| 3816 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3817 | break; |
| 3818 | case 0x10ec0262: |
| 3819 | case 0x10ec0267: |
| 3820 | case 0x10ec0268: |
| 3821 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3822 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3823 | case 0x10ec0272: |
| 3824 | case 0x10ec0660: |
| 3825 | case 0x10ec0662: |
| 3826 | case 0x10ec0663: |
| 3827 | case 0x10ec0862: |
| 3828 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3829 | set_eapd(codec, 0x14, 0); |
| 3830 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3831 | break; |
| 3832 | } |
| 3833 | } |
| 3834 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3835 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 3836 | { |
| 3837 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3838 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3839 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3840 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3841 | return 0; |
| 3842 | } |
| 3843 | #endif |
| 3844 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3845 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3846 | static int alc_resume(struct hda_codec *codec) |
| 3847 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3848 | codec->patch_ops.init(codec); |
| 3849 | snd_hda_codec_resume_amp(codec); |
| 3850 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 3851 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3852 | if (codec->patch_ops.check_power_status) |
| 3853 | codec->patch_ops.check_power_status(codec, 0x01); |
| 3854 | #endif |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3855 | return 0; |
| 3856 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3857 | #endif |
| 3858 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3859 | /* |
| 3860 | */ |
| 3861 | static struct hda_codec_ops alc_patch_ops = { |
| 3862 | .build_controls = alc_build_controls, |
| 3863 | .build_pcms = alc_build_pcms, |
| 3864 | .init = alc_init, |
| 3865 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3866 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3867 | #ifdef SND_HDA_NEEDS_RESUME |
| 3868 | .resume = alc_resume, |
| 3869 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3870 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3871 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3872 | .check_power_status = alc_check_power_status, |
| 3873 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3874 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3875 | }; |
| 3876 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 3877 | /* replace the codec chip_name with the given string */ |
| 3878 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 3879 | { |
| 3880 | kfree(codec->chip_name); |
| 3881 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 3882 | if (!codec->chip_name) { |
| 3883 | alc_free(codec); |
| 3884 | return -ENOMEM; |
| 3885 | } |
| 3886 | return 0; |
| 3887 | } |
| 3888 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3889 | /* |
| 3890 | * Test configuration for debugging |
| 3891 | * |
| 3892 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3893 | * enum controls. |
| 3894 | */ |
| 3895 | #ifdef CONFIG_SND_DEBUG |
| 3896 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3897 | 0x02, 0x03, 0x04, 0x05 |
| 3898 | }; |
| 3899 | |
| 3900 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3901 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3902 | .items = { |
| 3903 | { "In-1", 0x0 }, |
| 3904 | { "In-2", 0x1 }, |
| 3905 | { "In-3", 0x2 }, |
| 3906 | { "In-4", 0x3 }, |
| 3907 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3908 | { "Front", 0x5 }, |
| 3909 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3910 | }, |
| 3911 | }; |
| 3912 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3913 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3914 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3915 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3916 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3917 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3918 | }; |
| 3919 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3920 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3921 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3922 | { |
| 3923 | static char *texts[] = { |
| 3924 | "N/A", "Line Out", "HP Out", |
| 3925 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3926 | }; |
| 3927 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3928 | uinfo->count = 1; |
| 3929 | uinfo->value.enumerated.items = 8; |
| 3930 | if (uinfo->value.enumerated.item >= 8) |
| 3931 | uinfo->value.enumerated.item = 7; |
| 3932 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3933 | return 0; |
| 3934 | } |
| 3935 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3936 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3937 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3938 | { |
| 3939 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3940 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3941 | unsigned int pin_ctl, item = 0; |
| 3942 | |
| 3943 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3944 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3945 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3946 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3947 | item = 2; |
| 3948 | else |
| 3949 | item = 1; |
| 3950 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3951 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3952 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3953 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3954 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3955 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3956 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3957 | } |
| 3958 | } |
| 3959 | ucontrol->value.enumerated.item[0] = item; |
| 3960 | return 0; |
| 3961 | } |
| 3962 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3963 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3964 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3965 | { |
| 3966 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3967 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3968 | static unsigned int ctls[] = { |
| 3969 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3970 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3971 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3972 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3973 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3974 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3975 | }; |
| 3976 | unsigned int old_ctl, new_ctl; |
| 3977 | |
| 3978 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3979 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3980 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3981 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3982 | int val; |
| 3983 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3984 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3985 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3986 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3987 | HDA_AMP_MUTE : 0; |
| 3988 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3989 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3990 | return 1; |
| 3991 | } |
| 3992 | return 0; |
| 3993 | } |
| 3994 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3995 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3996 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3997 | { |
| 3998 | static char *texts[] = { |
| 3999 | "Front", "Surround", "CLFE", "Side" |
| 4000 | }; |
| 4001 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4002 | uinfo->count = 1; |
| 4003 | uinfo->value.enumerated.items = 4; |
| 4004 | if (uinfo->value.enumerated.item >= 4) |
| 4005 | uinfo->value.enumerated.item = 3; |
| 4006 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4007 | return 0; |
| 4008 | } |
| 4009 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4010 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4011 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4012 | { |
| 4013 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4014 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4015 | unsigned int sel; |
| 4016 | |
| 4017 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4018 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4019 | return 0; |
| 4020 | } |
| 4021 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4022 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4023 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4024 | { |
| 4025 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4026 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4027 | unsigned int sel; |
| 4028 | |
| 4029 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4030 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4031 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4032 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4033 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4034 | return 1; |
| 4035 | } |
| 4036 | return 0; |
| 4037 | } |
| 4038 | |
| 4039 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4040 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4041 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4042 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4043 | .info = alc_test_pin_ctl_info, \ |
| 4044 | .get = alc_test_pin_ctl_get, \ |
| 4045 | .put = alc_test_pin_ctl_put, \ |
| 4046 | .private_value = nid \ |
| 4047 | } |
| 4048 | |
| 4049 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4050 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4051 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4052 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4053 | .info = alc_test_pin_src_info, \ |
| 4054 | .get = alc_test_pin_src_get, \ |
| 4055 | .put = alc_test_pin_src_put, \ |
| 4056 | .private_value = nid \ |
| 4057 | } |
| 4058 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4059 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4060 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4061 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4062 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4063 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4064 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4065 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4066 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4067 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4068 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4069 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4070 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4071 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4072 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4073 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4074 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4075 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4076 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4077 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4078 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4079 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4080 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4081 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4082 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4083 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4084 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4085 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4086 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4087 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4088 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4089 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4090 | { |
| 4091 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4092 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4093 | .info = alc_ch_mode_info, |
| 4094 | .get = alc_ch_mode_get, |
| 4095 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4096 | }, |
| 4097 | { } /* end */ |
| 4098 | }; |
| 4099 | |
| 4100 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4101 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4102 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4103 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4104 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4105 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4106 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4107 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4108 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4109 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4110 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4111 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4112 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4113 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4114 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4115 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4116 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4117 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4118 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4119 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4120 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4121 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4122 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4123 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4124 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4125 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4126 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4127 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4128 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4129 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4130 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4131 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4132 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4133 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4134 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4135 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4136 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4137 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4138 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4139 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4140 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4141 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4142 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4143 | /* Analog input/passthru */ |
| 4144 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4145 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4146 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4147 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4148 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4149 | { } |
| 4150 | }; |
| 4151 | #endif |
| 4152 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4153 | /* |
| 4154 | */ |
| 4155 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4156 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 4157 | [ALC880_3ST] = "3stack", |
| 4158 | [ALC880_TCL_S700] = "tcl", |
| 4159 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4160 | [ALC880_CLEVO] = "clevo", |
| 4161 | [ALC880_5ST] = "5stack", |
| 4162 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4163 | [ALC880_W810] = "w810", |
| 4164 | [ALC880_Z71V] = "z71v", |
| 4165 | [ALC880_6ST] = "6stack", |
| 4166 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4167 | [ALC880_ASUS] = "asus", |
| 4168 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4169 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4170 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4171 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4172 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4173 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4174 | [ALC880_F1734] = "F1734", |
| 4175 | [ALC880_LG] = "lg", |
| 4176 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4177 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4178 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4179 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4180 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4181 | [ALC880_AUTO] = "auto", |
| 4182 | }; |
| 4183 | |
| 4184 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4185 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4186 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4187 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4188 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4189 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4190 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4191 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4192 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4193 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4194 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4195 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4196 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4197 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4198 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4199 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4200 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4201 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4202 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4203 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4204 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4205 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4206 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4207 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4208 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4209 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4210 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4211 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4212 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4213 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4214 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4215 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4216 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4217 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4218 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4219 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4220 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4221 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4222 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4223 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4224 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4225 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4226 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4227 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4228 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4229 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4230 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4231 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4232 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4233 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4234 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4235 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4236 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4237 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 4238 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4239 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4240 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4241 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4242 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4243 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4244 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4245 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4246 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4247 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4248 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4249 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4250 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4251 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4252 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4253 | /* default Intel */ |
| 4254 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4255 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4256 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4257 | {} |
| 4258 | }; |
| 4259 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4260 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4261 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4262 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4263 | static struct alc_config_preset alc880_presets[] = { |
| 4264 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4265 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4266 | .init_verbs = { alc880_volume_init_verbs, |
| 4267 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4268 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4269 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4270 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4271 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4272 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4273 | .input_mux = &alc880_capture_source, |
| 4274 | }, |
| 4275 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4276 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4277 | .init_verbs = { alc880_volume_init_verbs, |
| 4278 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4279 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4280 | .dac_nids = alc880_dac_nids, |
| 4281 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4282 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4283 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4284 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4285 | .input_mux = &alc880_capture_source, |
| 4286 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4287 | [ALC880_TCL_S700] = { |
| 4288 | .mixers = { alc880_tcl_s700_mixer }, |
| 4289 | .init_verbs = { alc880_volume_init_verbs, |
| 4290 | alc880_pin_tcl_S700_init_verbs, |
| 4291 | alc880_gpio2_init_verbs }, |
| 4292 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4293 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4294 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4295 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4296 | .hp_nid = 0x03, |
| 4297 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4298 | .channel_mode = alc880_2_jack_modes, |
| 4299 | .input_mux = &alc880_capture_source, |
| 4300 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4301 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4302 | .mixers = { alc880_three_stack_mixer, |
| 4303 | alc880_five_stack_mixer}, |
| 4304 | .init_verbs = { alc880_volume_init_verbs, |
| 4305 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4306 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4307 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4308 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4309 | .channel_mode = alc880_fivestack_modes, |
| 4310 | .input_mux = &alc880_capture_source, |
| 4311 | }, |
| 4312 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4313 | .mixers = { alc880_three_stack_mixer, |
| 4314 | alc880_five_stack_mixer }, |
| 4315 | .init_verbs = { alc880_volume_init_verbs, |
| 4316 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4317 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4318 | .dac_nids = alc880_dac_nids, |
| 4319 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4320 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4321 | .channel_mode = alc880_fivestack_modes, |
| 4322 | .input_mux = &alc880_capture_source, |
| 4323 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4324 | [ALC880_6ST] = { |
| 4325 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4326 | .init_verbs = { alc880_volume_init_verbs, |
| 4327 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4328 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4329 | .dac_nids = alc880_6st_dac_nids, |
| 4330 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4331 | .channel_mode = alc880_sixstack_modes, |
| 4332 | .input_mux = &alc880_6stack_capture_source, |
| 4333 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4334 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4335 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4336 | .init_verbs = { alc880_volume_init_verbs, |
| 4337 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4338 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4339 | .dac_nids = alc880_6st_dac_nids, |
| 4340 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4341 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4342 | .channel_mode = alc880_sixstack_modes, |
| 4343 | .input_mux = &alc880_6stack_capture_source, |
| 4344 | }, |
| 4345 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4346 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4347 | .init_verbs = { alc880_volume_init_verbs, |
| 4348 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4349 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4350 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4351 | .dac_nids = alc880_w810_dac_nids, |
| 4352 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4353 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4354 | .channel_mode = alc880_w810_modes, |
| 4355 | .input_mux = &alc880_capture_source, |
| 4356 | }, |
| 4357 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4358 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4359 | .init_verbs = { alc880_volume_init_verbs, |
| 4360 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4361 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4362 | .dac_nids = alc880_z71v_dac_nids, |
| 4363 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4364 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4365 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4366 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4367 | .input_mux = &alc880_capture_source, |
| 4368 | }, |
| 4369 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4370 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4371 | .init_verbs = { alc880_volume_init_verbs, |
| 4372 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4373 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4374 | .dac_nids = alc880_f1734_dac_nids, |
| 4375 | .hp_nid = 0x02, |
| 4376 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4377 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4378 | .input_mux = &alc880_f1734_capture_source, |
| 4379 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4380 | .setup = alc880_uniwill_p53_setup, |
| 4381 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4382 | }, |
| 4383 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4384 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4385 | .init_verbs = { alc880_volume_init_verbs, |
| 4386 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4387 | alc880_gpio1_init_verbs }, |
| 4388 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4389 | .dac_nids = alc880_asus_dac_nids, |
| 4390 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4391 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4392 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4393 | .input_mux = &alc880_capture_source, |
| 4394 | }, |
| 4395 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4396 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4397 | .init_verbs = { alc880_volume_init_verbs, |
| 4398 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4399 | alc880_gpio1_init_verbs }, |
| 4400 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4401 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4402 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4403 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4404 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4405 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4406 | .input_mux = &alc880_capture_source, |
| 4407 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4408 | [ALC880_ASUS_DIG2] = { |
| 4409 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4410 | .init_verbs = { alc880_volume_init_verbs, |
| 4411 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4412 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4413 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4414 | .dac_nids = alc880_asus_dac_nids, |
| 4415 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4416 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4417 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4418 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4419 | .input_mux = &alc880_capture_source, |
| 4420 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4421 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4422 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4423 | .init_verbs = { alc880_volume_init_verbs, |
| 4424 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4425 | alc880_gpio1_init_verbs }, |
| 4426 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4427 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4428 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4429 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4430 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4431 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4432 | .input_mux = &alc880_capture_source, |
| 4433 | }, |
| 4434 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4435 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4436 | .init_verbs = { alc880_volume_init_verbs, |
| 4437 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4438 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4439 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4440 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4441 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4442 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4443 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4444 | .input_mux = &alc880_capture_source, |
| 4445 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4446 | [ALC880_UNIWILL] = { |
| 4447 | .mixers = { alc880_uniwill_mixer }, |
| 4448 | .init_verbs = { alc880_volume_init_verbs, |
| 4449 | alc880_uniwill_init_verbs }, |
| 4450 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4451 | .dac_nids = alc880_asus_dac_nids, |
| 4452 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4453 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4454 | .channel_mode = alc880_threestack_modes, |
| 4455 | .need_dac_fix = 1, |
| 4456 | .input_mux = &alc880_capture_source, |
| 4457 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4458 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4459 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4460 | }, |
| 4461 | [ALC880_UNIWILL_P53] = { |
| 4462 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4463 | .init_verbs = { alc880_volume_init_verbs, |
| 4464 | alc880_uniwill_p53_init_verbs }, |
| 4465 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4466 | .dac_nids = alc880_asus_dac_nids, |
| 4467 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4468 | .channel_mode = alc880_threestack_modes, |
| 4469 | .input_mux = &alc880_capture_source, |
| 4470 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4471 | .setup = alc880_uniwill_p53_setup, |
| 4472 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4473 | }, |
| 4474 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4475 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4476 | .init_verbs = { alc880_volume_init_verbs, |
| 4477 | alc880_uniwill_p53_init_verbs, |
| 4478 | alc880_beep_init_verbs }, |
| 4479 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4480 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4481 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4482 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4483 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4484 | .input_mux = &alc880_capture_source, |
| 4485 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4486 | .setup = alc880_uniwill_p53_setup, |
| 4487 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4488 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4489 | [ALC880_CLEVO] = { |
| 4490 | .mixers = { alc880_three_stack_mixer }, |
| 4491 | .init_verbs = { alc880_volume_init_verbs, |
| 4492 | alc880_pin_clevo_init_verbs }, |
| 4493 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4494 | .dac_nids = alc880_dac_nids, |
| 4495 | .hp_nid = 0x03, |
| 4496 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4497 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4498 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4499 | .input_mux = &alc880_capture_source, |
| 4500 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4501 | [ALC880_LG] = { |
| 4502 | .mixers = { alc880_lg_mixer }, |
| 4503 | .init_verbs = { alc880_volume_init_verbs, |
| 4504 | alc880_lg_init_verbs }, |
| 4505 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4506 | .dac_nids = alc880_lg_dac_nids, |
| 4507 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4508 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4509 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4510 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4511 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4512 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4513 | .setup = alc880_lg_setup, |
| 4514 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4515 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4516 | .loopbacks = alc880_lg_loopbacks, |
| 4517 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4518 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4519 | [ALC880_LG_LW] = { |
| 4520 | .mixers = { alc880_lg_lw_mixer }, |
| 4521 | .init_verbs = { alc880_volume_init_verbs, |
| 4522 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4523 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4524 | .dac_nids = alc880_dac_nids, |
| 4525 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4526 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4527 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4528 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4529 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4530 | .setup = alc880_lg_lw_setup, |
| 4531 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4532 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4533 | [ALC880_MEDION_RIM] = { |
| 4534 | .mixers = { alc880_medion_rim_mixer }, |
| 4535 | .init_verbs = { alc880_volume_init_verbs, |
| 4536 | alc880_medion_rim_init_verbs, |
| 4537 | alc_gpio2_init_verbs }, |
| 4538 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4539 | .dac_nids = alc880_dac_nids, |
| 4540 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4541 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4542 | .channel_mode = alc880_2_jack_modes, |
| 4543 | .input_mux = &alc880_medion_rim_capture_source, |
| 4544 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4545 | .setup = alc880_medion_rim_setup, |
| 4546 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4547 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4548 | #ifdef CONFIG_SND_DEBUG |
| 4549 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4550 | .mixers = { alc880_test_mixer }, |
| 4551 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4552 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4553 | .dac_nids = alc880_test_dac_nids, |
| 4554 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4555 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4556 | .channel_mode = alc880_test_modes, |
| 4557 | .input_mux = &alc880_test_capture_source, |
| 4558 | }, |
| 4559 | #endif |
| 4560 | }; |
| 4561 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4562 | /* |
| 4563 | * Automatic parse of I/O pins from the BIOS configuration |
| 4564 | */ |
| 4565 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4566 | enum { |
| 4567 | ALC_CTL_WIDGET_VOL, |
| 4568 | ALC_CTL_WIDGET_MUTE, |
| 4569 | ALC_CTL_BIND_MUTE, |
| 4570 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4571 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4572 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4573 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4574 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4575 | }; |
| 4576 | |
| 4577 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4578 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4579 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4580 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4581 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4582 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4583 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4584 | knew = snd_array_new(&spec->kctls); |
| 4585 | if (!knew) |
| 4586 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4587 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4588 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4589 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4590 | return -ENOMEM; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 4591 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 4592 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4593 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4594 | return 0; |
| 4595 | } |
| 4596 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4597 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 4598 | const char *pfx, const char *dir, |
| 4599 | const char *sfx, unsigned long val) |
| 4600 | { |
| 4601 | char name[32]; |
| 4602 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
| 4603 | return add_control(spec, type, name, val); |
| 4604 | } |
| 4605 | |
| 4606 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 4607 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val) |
| 4608 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 4609 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val) |
| 4610 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4611 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4612 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4613 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4614 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4615 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4616 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4617 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4618 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4619 | #define ALC880_PIN_CD_NID 0x1c |
| 4620 | |
| 4621 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4622 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4623 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4624 | { |
| 4625 | hda_nid_t nid; |
| 4626 | int assigned[4]; |
| 4627 | int i, j; |
| 4628 | |
| 4629 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4630 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4631 | |
| 4632 | /* check the pins hardwired to audio widget */ |
| 4633 | for (i = 0; i < cfg->line_outs; i++) { |
| 4634 | nid = cfg->line_out_pins[i]; |
| 4635 | if (alc880_is_fixed_pin(nid)) { |
| 4636 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4637 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4638 | assigned[idx] = 1; |
| 4639 | } |
| 4640 | } |
| 4641 | /* left pins can be connect to any audio widget */ |
| 4642 | for (i = 0; i < cfg->line_outs; i++) { |
| 4643 | nid = cfg->line_out_pins[i]; |
| 4644 | if (alc880_is_fixed_pin(nid)) |
| 4645 | continue; |
| 4646 | /* search for an empty channel */ |
| 4647 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4648 | if (!assigned[j]) { |
| 4649 | spec->multiout.dac_nids[i] = |
| 4650 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4651 | assigned[j] = 1; |
| 4652 | break; |
| 4653 | } |
| 4654 | } |
| 4655 | } |
| 4656 | spec->multiout.num_dacs = cfg->line_outs; |
| 4657 | return 0; |
| 4658 | } |
| 4659 | |
| 4660 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4661 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4662 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4663 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4664 | static const char *chname[4] = { |
| 4665 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4666 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4667 | hda_nid_t nid; |
| 4668 | int i, err; |
| 4669 | |
| 4670 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4671 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4672 | continue; |
| 4673 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4674 | if (i == 2) { |
| 4675 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4676 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4677 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4678 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4679 | HDA_OUTPUT)); |
| 4680 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4681 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4682 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4683 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4684 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4685 | HDA_OUTPUT)); |
| 4686 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4687 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4688 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4689 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4690 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4691 | HDA_INPUT)); |
| 4692 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4693 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4694 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4695 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4696 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4697 | HDA_INPUT)); |
| 4698 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4699 | return err; |
| 4700 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4701 | const char *pfx; |
| 4702 | if (cfg->line_outs == 1 && |
| 4703 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 4704 | pfx = "Speaker"; |
| 4705 | else |
| 4706 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4707 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4708 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4709 | HDA_OUTPUT)); |
| 4710 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4711 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4712 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4713 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4714 | HDA_INPUT)); |
| 4715 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4716 | return err; |
| 4717 | } |
| 4718 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4719 | return 0; |
| 4720 | } |
| 4721 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4722 | /* add playback controls for speaker and HP outputs */ |
| 4723 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4724 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4725 | { |
| 4726 | hda_nid_t nid; |
| 4727 | int err; |
| 4728 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4729 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4730 | return 0; |
| 4731 | |
| 4732 | if (alc880_is_fixed_pin(pin)) { |
| 4733 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4734 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4735 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4736 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4737 | else |
| 4738 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4739 | /* control HP volume/switch on the output mixer amp */ |
| 4740 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4741 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4742 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4743 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4744 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4745 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4746 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4747 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4748 | return err; |
| 4749 | } else if (alc880_is_multi_pin(pin)) { |
| 4750 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4751 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4752 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4753 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4754 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4755 | return err; |
| 4756 | } |
| 4757 | return 0; |
| 4758 | } |
| 4759 | |
| 4760 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4761 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4762 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4763 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4764 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4765 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4766 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4767 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4768 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4769 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4770 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4771 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4772 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4773 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4774 | return err; |
| 4775 | return 0; |
| 4776 | } |
| 4777 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4778 | 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] | 4779 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4780 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 4781 | return (pincap & AC_PINCAP_IN) != 0; |
| 4782 | } |
| 4783 | |
| 4784 | /* create playback/capture controls for input pins */ |
| 4785 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 4786 | const struct auto_pin_cfg *cfg, |
| 4787 | hda_nid_t mixer, |
| 4788 | hda_nid_t cap1, hda_nid_t cap2) |
| 4789 | { |
| 4790 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4791 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4792 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4793 | |
| 4794 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4795 | hda_nid_t pin; |
| 4796 | |
| 4797 | pin = cfg->input_pins[i]; |
| 4798 | if (!alc_is_input_pin(codec, pin)) |
| 4799 | continue; |
| 4800 | |
| 4801 | if (mixer) { |
| 4802 | idx = get_connection_index(codec, mixer, pin); |
| 4803 | if (idx >= 0) { |
| 4804 | err = new_analog_input(spec, pin, |
| 4805 | auto_pin_cfg_labels[i], |
| 4806 | idx, mixer); |
| 4807 | if (err < 0) |
| 4808 | return err; |
| 4809 | } |
| 4810 | } |
| 4811 | |
| 4812 | if (!cap1) |
| 4813 | continue; |
| 4814 | idx = get_connection_index(codec, cap1, pin); |
| 4815 | if (idx < 0 && cap2) |
| 4816 | idx = get_connection_index(codec, cap2, pin); |
| 4817 | if (idx >= 0) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4818 | imux->items[imux->num_items].label = |
| 4819 | auto_pin_cfg_labels[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4820 | imux->items[imux->num_items].index = idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4821 | imux->num_items++; |
| 4822 | } |
| 4823 | } |
| 4824 | return 0; |
| 4825 | } |
| 4826 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4827 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 4828 | const struct auto_pin_cfg *cfg) |
| 4829 | { |
| 4830 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 4831 | } |
| 4832 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4833 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4834 | unsigned int pin_type) |
| 4835 | { |
| 4836 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4837 | pin_type); |
| 4838 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4839 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4840 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4841 | } |
| 4842 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4843 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4844 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4845 | int dac_idx) |
| 4846 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4847 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4848 | /* need the manual connection? */ |
| 4849 | if (alc880_is_multi_pin(nid)) { |
| 4850 | struct alc_spec *spec = codec->spec; |
| 4851 | int idx = alc880_multi_pin_idx(nid); |
| 4852 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4853 | AC_VERB_SET_CONNECT_SEL, |
| 4854 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4855 | } |
| 4856 | } |
| 4857 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4858 | static int get_pin_type(int line_out_type) |
| 4859 | { |
| 4860 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4861 | return PIN_HP; |
| 4862 | else |
| 4863 | return PIN_OUT; |
| 4864 | } |
| 4865 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4866 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4867 | { |
| 4868 | struct alc_spec *spec = codec->spec; |
| 4869 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4870 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4871 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4872 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4873 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4874 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4875 | } |
| 4876 | } |
| 4877 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4878 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4879 | { |
| 4880 | struct alc_spec *spec = codec->spec; |
| 4881 | hda_nid_t pin; |
| 4882 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4883 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4884 | if (pin) /* connect to front */ |
| 4885 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4886 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4887 | if (pin) /* connect to front */ |
| 4888 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4889 | } |
| 4890 | |
| 4891 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4892 | { |
| 4893 | struct alc_spec *spec = codec->spec; |
| 4894 | int i; |
| 4895 | |
| 4896 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4897 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4898 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4899 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4900 | if (nid != ALC880_PIN_CD_NID && |
| 4901 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4902 | snd_hda_codec_write(codec, nid, 0, |
| 4903 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4904 | AMP_OUT_MUTE); |
| 4905 | } |
| 4906 | } |
| 4907 | } |
| 4908 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 4909 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 4910 | { |
| 4911 | struct alc_spec *spec = codec->spec; |
| 4912 | int c; |
| 4913 | |
| 4914 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 4915 | unsigned int mux_idx; |
| 4916 | const struct hda_input_mux *imux; |
| 4917 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 4918 | imux = &spec->input_mux[mux_idx]; |
| 4919 | if (!imux->num_items && mux_idx > 0) |
| 4920 | imux = &spec->input_mux[0]; |
| 4921 | if (imux) |
| 4922 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 4923 | AC_VERB_SET_CONNECT_SEL, |
| 4924 | imux->items[0].index); |
| 4925 | } |
| 4926 | } |
| 4927 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4928 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4929 | /* return 1 if successful, 0 if the proper config is not found, |
| 4930 | * or a negative error code |
| 4931 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4932 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4933 | { |
| 4934 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4935 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4936 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4937 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4938 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4939 | alc880_ignore); |
| 4940 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4941 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4942 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4943 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4944 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4945 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4946 | if (err < 0) |
| 4947 | return err; |
| 4948 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4949 | if (err < 0) |
| 4950 | return err; |
| 4951 | err = alc880_auto_create_extra_out(spec, |
| 4952 | spec->autocfg.speaker_pins[0], |
| 4953 | "Speaker"); |
| 4954 | if (err < 0) |
| 4955 | return err; |
| 4956 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4957 | "Headphone"); |
| 4958 | if (err < 0) |
| 4959 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4960 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4961 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4962 | return err; |
| 4963 | |
| 4964 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4965 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4966 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4967 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4968 | hda_nid_t dig_nid; |
| 4969 | err = snd_hda_get_connections(codec, |
| 4970 | spec->autocfg.dig_out_pins[i], |
| 4971 | &dig_nid, 1); |
| 4972 | if (err < 0) |
| 4973 | continue; |
| 4974 | if (!i) |
| 4975 | spec->multiout.dig_out_nid = dig_nid; |
| 4976 | else { |
| 4977 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 4978 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4979 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 4980 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4981 | } |
| 4982 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4983 | if (spec->autocfg.dig_in_pin) |
| 4984 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4985 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4986 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4987 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4988 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4989 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4990 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4991 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4992 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4993 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 4994 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4995 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4996 | return 1; |
| 4997 | } |
| 4998 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4999 | /* additional initialization for auto-configuration model */ |
| 5000 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5001 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5002 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5003 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5004 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5005 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5006 | alc880_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5007 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5008 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5009 | } |
| 5010 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5011 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5012 | * one of two digital mic pins, e.g. on ALC272 |
| 5013 | */ |
| 5014 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5015 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5016 | struct alc_spec *spec = codec->spec; |
| 5017 | int i; |
| 5018 | |
| 5019 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5020 | hda_nid_t cap = spec->capsrc_nids ? |
| 5021 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5022 | int iidx, eidx; |
| 5023 | |
| 5024 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5025 | if (iidx < 0) |
| 5026 | continue; |
| 5027 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5028 | if (eidx < 0) |
| 5029 | continue; |
| 5030 | spec->int_mic.mux_idx = iidx; |
| 5031 | spec->ext_mic.mux_idx = eidx; |
| 5032 | if (spec->capsrc_nids) |
| 5033 | spec->capsrc_nids += i; |
| 5034 | spec->adc_nids += i; |
| 5035 | spec->num_adc_nids = 1; |
| 5036 | return; |
| 5037 | } |
| 5038 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5039 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5040 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5041 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5042 | } |
| 5043 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5044 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5045 | static void fixup_single_adc(struct hda_codec *codec) |
| 5046 | { |
| 5047 | struct alc_spec *spec = codec->spec; |
Frederik Deweerdt | d2db09b | 2010-03-05 16:34:31 +0100 | [diff] [blame] | 5048 | hda_nid_t pin = 0; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5049 | int i; |
| 5050 | |
| 5051 | /* search for the input pin; there must be only one */ |
| 5052 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5053 | if (spec->autocfg.input_pins[i]) { |
| 5054 | pin = spec->autocfg.input_pins[i]; |
| 5055 | break; |
| 5056 | } |
| 5057 | } |
| 5058 | if (!pin) |
| 5059 | return; |
| 5060 | |
| 5061 | /* set the default connection to that pin */ |
| 5062 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5063 | hda_nid_t cap = spec->capsrc_nids ? |
| 5064 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5065 | int idx; |
| 5066 | |
| 5067 | idx = get_connection_index(codec, cap, pin); |
| 5068 | if (idx < 0) |
| 5069 | continue; |
| 5070 | /* use only this ADC */ |
| 5071 | if (spec->capsrc_nids) |
| 5072 | spec->capsrc_nids += i; |
| 5073 | spec->adc_nids += i; |
| 5074 | spec->num_adc_nids = 1; |
| 5075 | /* select or unmute this route */ |
| 5076 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5077 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5078 | HDA_AMP_MUTE, 0); |
| 5079 | } else { |
| 5080 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5081 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5082 | } |
| 5083 | return; |
| 5084 | } |
| 5085 | } |
| 5086 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5087 | static void set_capture_mixer(struct hda_codec *codec) |
| 5088 | { |
| 5089 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5090 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5091 | { alc_capture_mixer_nosrc1, |
| 5092 | alc_capture_mixer_nosrc2, |
| 5093 | alc_capture_mixer_nosrc3 }, |
| 5094 | { alc_capture_mixer1, |
| 5095 | alc_capture_mixer2, |
| 5096 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5097 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5098 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5099 | int mux = 0; |
| 5100 | if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5101 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5102 | else if (spec->input_mux) { |
| 5103 | if (spec->input_mux->num_items > 1) |
| 5104 | mux = 1; |
| 5105 | else if (spec->input_mux->num_items == 1) |
| 5106 | fixup_single_adc(codec); |
| 5107 | } |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5108 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 5109 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5110 | } |
| 5111 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5112 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5113 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5114 | int num_nids) |
| 5115 | { |
| 5116 | struct alc_spec *spec = codec->spec; |
| 5117 | int n; |
| 5118 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5119 | |
| 5120 | for (n = 0; n < num_nids; n++) { |
| 5121 | hda_nid_t adc, cap; |
| 5122 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5123 | int nconns, i, j; |
| 5124 | |
| 5125 | adc = nids[n]; |
| 5126 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5127 | continue; |
| 5128 | cap = adc; |
| 5129 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5130 | ARRAY_SIZE(conn)); |
| 5131 | if (nconns == 1) { |
| 5132 | cap = conn[0]; |
| 5133 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5134 | ARRAY_SIZE(conn)); |
| 5135 | } |
| 5136 | if (nconns <= 0) |
| 5137 | continue; |
| 5138 | if (!fallback_adc) { |
| 5139 | fallback_adc = adc; |
| 5140 | fallback_cap = cap; |
| 5141 | } |
| 5142 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5143 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5144 | if (!nid) |
| 5145 | continue; |
| 5146 | for (j = 0; j < nconns; j++) { |
| 5147 | if (conn[j] == nid) |
| 5148 | break; |
| 5149 | } |
| 5150 | if (j >= nconns) |
| 5151 | break; |
| 5152 | } |
| 5153 | if (i >= AUTO_PIN_LAST) { |
| 5154 | int num_adcs = spec->num_adc_nids; |
| 5155 | spec->private_adc_nids[num_adcs] = adc; |
| 5156 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5157 | spec->num_adc_nids++; |
| 5158 | spec->adc_nids = spec->private_adc_nids; |
| 5159 | if (adc != cap) |
| 5160 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5161 | } |
| 5162 | } |
| 5163 | if (!spec->num_adc_nids) { |
| 5164 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5165 | " using fallback 0x%x\n", |
| 5166 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5167 | spec->private_adc_nids[0] = fallback_adc; |
| 5168 | spec->adc_nids = spec->private_adc_nids; |
| 5169 | if (fallback_adc != fallback_cap) { |
| 5170 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5171 | spec->capsrc_nids = spec->private_adc_nids; |
| 5172 | } |
| 5173 | } |
| 5174 | } |
| 5175 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5176 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5177 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5178 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5179 | #else |
| 5180 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
| 5181 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5182 | |
| 5183 | /* |
| 5184 | * OK, here we have finally the patch for ALC880 |
| 5185 | */ |
| 5186 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5187 | static int patch_alc880(struct hda_codec *codec) |
| 5188 | { |
| 5189 | struct alc_spec *spec; |
| 5190 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5191 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5192 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5193 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5194 | if (spec == NULL) |
| 5195 | return -ENOMEM; |
| 5196 | |
| 5197 | codec->spec = spec; |
| 5198 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5199 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5200 | alc880_models, |
| 5201 | alc880_cfg_tbl); |
| 5202 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5203 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5204 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5205 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5206 | } |
| 5207 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5208 | if (board_config == ALC880_AUTO) { |
| 5209 | /* automatic parse from the BIOS config */ |
| 5210 | err = alc880_parse_auto_config(codec); |
| 5211 | if (err < 0) { |
| 5212 | alc_free(codec); |
| 5213 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5214 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5215 | printk(KERN_INFO |
| 5216 | "hda_codec: Cannot set up configuration " |
| 5217 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5218 | board_config = ALC880_3ST; |
| 5219 | } |
| 5220 | } |
| 5221 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5222 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5223 | if (err < 0) { |
| 5224 | alc_free(codec); |
| 5225 | return err; |
| 5226 | } |
| 5227 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5228 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5229 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5230 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5231 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5232 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5233 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5234 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5235 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5236 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5237 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5238 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5239 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5240 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5241 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5242 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5243 | if (wcap != AC_WID_AUD_IN) { |
| 5244 | spec->adc_nids = alc880_adc_nids_alt; |
| 5245 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5246 | } else { |
| 5247 | spec->adc_nids = alc880_adc_nids; |
| 5248 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5249 | } |
| 5250 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5251 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5252 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5253 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5254 | spec->vmaster_nid = 0x0c; |
| 5255 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5256 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5257 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5258 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5259 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5260 | if (!spec->loopback.amplist) |
| 5261 | spec->loopback.amplist = alc880_loopbacks; |
| 5262 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5263 | |
| 5264 | return 0; |
| 5265 | } |
| 5266 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5267 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5268 | /* |
| 5269 | * ALC260 support |
| 5270 | */ |
| 5271 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5272 | static hda_nid_t alc260_dac_nids[1] = { |
| 5273 | /* front */ |
| 5274 | 0x02, |
| 5275 | }; |
| 5276 | |
| 5277 | static hda_nid_t alc260_adc_nids[1] = { |
| 5278 | /* ADC0 */ |
| 5279 | 0x04, |
| 5280 | }; |
| 5281 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5282 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5283 | /* ADC1 */ |
| 5284 | 0x05, |
| 5285 | }; |
| 5286 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5287 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5288 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5289 | */ |
| 5290 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5291 | /* ADC0, ADC1 */ |
| 5292 | 0x04, 0x05 |
| 5293 | }; |
| 5294 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5295 | #define ALC260_DIGOUT_NID 0x03 |
| 5296 | #define ALC260_DIGIN_NID 0x06 |
| 5297 | |
| 5298 | static struct hda_input_mux alc260_capture_source = { |
| 5299 | .num_items = 4, |
| 5300 | .items = { |
| 5301 | { "Mic", 0x0 }, |
| 5302 | { "Front Mic", 0x1 }, |
| 5303 | { "Line", 0x2 }, |
| 5304 | { "CD", 0x4 }, |
| 5305 | }, |
| 5306 | }; |
| 5307 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5308 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5309 | * headphone jack and the internal CD lines since these are the only pins at |
| 5310 | * which audio can appear. For flexibility, also allow the option of |
| 5311 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5312 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5313 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5314 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5315 | { |
| 5316 | .num_items = 3, |
| 5317 | .items = { |
| 5318 | { "Mic/Line", 0x0 }, |
| 5319 | { "CD", 0x4 }, |
| 5320 | { "Headphone", 0x2 }, |
| 5321 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5322 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5323 | { |
| 5324 | .num_items = 4, |
| 5325 | .items = { |
| 5326 | { "Mic/Line", 0x0 }, |
| 5327 | { "CD", 0x4 }, |
| 5328 | { "Headphone", 0x2 }, |
| 5329 | { "Mixer", 0x5 }, |
| 5330 | }, |
| 5331 | }, |
| 5332 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5333 | }; |
| 5334 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5335 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5336 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5337 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5338 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5339 | { |
| 5340 | .num_items = 4, |
| 5341 | .items = { |
| 5342 | { "Mic", 0x0 }, |
| 5343 | { "Line", 0x2 }, |
| 5344 | { "CD", 0x4 }, |
| 5345 | { "Headphone", 0x5 }, |
| 5346 | }, |
| 5347 | }, |
| 5348 | { |
| 5349 | .num_items = 5, |
| 5350 | .items = { |
| 5351 | { "Mic", 0x0 }, |
| 5352 | { "Line", 0x2 }, |
| 5353 | { "CD", 0x4 }, |
| 5354 | { "Headphone", 0x6 }, |
| 5355 | { "Mixer", 0x5 }, |
| 5356 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5357 | }, |
| 5358 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5359 | |
| 5360 | /* Maxdata Favorit 100XS */ |
| 5361 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5362 | { |
| 5363 | .num_items = 2, |
| 5364 | .items = { |
| 5365 | { "Line/Mic", 0x0 }, |
| 5366 | { "CD", 0x4 }, |
| 5367 | }, |
| 5368 | }, |
| 5369 | { |
| 5370 | .num_items = 3, |
| 5371 | .items = { |
| 5372 | { "Line/Mic", 0x0 }, |
| 5373 | { "CD", 0x4 }, |
| 5374 | { "Mixer", 0x5 }, |
| 5375 | }, |
| 5376 | }, |
| 5377 | }; |
| 5378 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5379 | /* |
| 5380 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5381 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5382 | * element which allows changing the channel mode, so the verb list is |
| 5383 | * never used. |
| 5384 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5385 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5386 | { 2, NULL }, |
| 5387 | }; |
| 5388 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5389 | |
| 5390 | /* Mixer combinations |
| 5391 | * |
| 5392 | * basic: base_output + input + pc_beep + capture |
| 5393 | * HP: base_output + input + capture_alt |
| 5394 | * HP_3013: hp_3013 + input + capture |
| 5395 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5396 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5397 | */ |
| 5398 | |
| 5399 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5400 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5401 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5402 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5403 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5404 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5405 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5406 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5407 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5408 | |
| 5409 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5410 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5411 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5412 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5413 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5414 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5415 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5416 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5417 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5418 | { } /* end */ |
| 5419 | }; |
| 5420 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5421 | /* update HP, line and mono out pins according to the master switch */ |
| 5422 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5423 | hda_nid_t hp, hda_nid_t line, |
| 5424 | hda_nid_t mono) |
| 5425 | { |
| 5426 | struct alc_spec *spec = codec->spec; |
| 5427 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5428 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5429 | 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] | 5430 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5431 | 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] | 5432 | val); |
| 5433 | /* mono (speaker) depending on the HP jack sense */ |
| 5434 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5435 | 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] | 5436 | val); |
| 5437 | } |
| 5438 | |
| 5439 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5440 | struct snd_ctl_elem_value *ucontrol) |
| 5441 | { |
| 5442 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5443 | struct alc_spec *spec = codec->spec; |
| 5444 | *ucontrol->value.integer.value = spec->master_sw; |
| 5445 | return 0; |
| 5446 | } |
| 5447 | |
| 5448 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5449 | struct snd_ctl_elem_value *ucontrol) |
| 5450 | { |
| 5451 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5452 | struct alc_spec *spec = codec->spec; |
| 5453 | int val = !!*ucontrol->value.integer.value; |
| 5454 | hda_nid_t hp, line, mono; |
| 5455 | |
| 5456 | if (val == spec->master_sw) |
| 5457 | return 0; |
| 5458 | spec->master_sw = val; |
| 5459 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5460 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5461 | mono = kcontrol->private_value & 0xff; |
| 5462 | alc260_hp_master_update(codec, hp, line, mono); |
| 5463 | return 1; |
| 5464 | } |
| 5465 | |
| 5466 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5467 | { |
| 5468 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5469 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5470 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5471 | .info = snd_ctl_boolean_mono_info, |
| 5472 | .get = alc260_hp_master_sw_get, |
| 5473 | .put = alc260_hp_master_sw_put, |
| 5474 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5475 | }, |
| 5476 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5477 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5478 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5479 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5480 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5481 | HDA_OUTPUT), |
| 5482 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5483 | { } /* end */ |
| 5484 | }; |
| 5485 | |
| 5486 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5487 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5488 | {}, |
| 5489 | }; |
| 5490 | |
| 5491 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5492 | { |
| 5493 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5494 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5495 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5496 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5497 | } |
| 5498 | |
| 5499 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5500 | { |
| 5501 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5502 | alc260_hp_automute(codec); |
| 5503 | } |
| 5504 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5505 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5506 | { |
| 5507 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5508 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5509 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5510 | .info = snd_ctl_boolean_mono_info, |
| 5511 | .get = alc260_hp_master_sw_get, |
| 5512 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5513 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5514 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5515 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5516 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5517 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5518 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5519 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5520 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5521 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5522 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5523 | { } /* end */ |
| 5524 | }; |
| 5525 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5526 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5527 | .ops = &snd_hda_bind_vol, |
| 5528 | .values = { |
| 5529 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5530 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5531 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5532 | 0 |
| 5533 | }, |
| 5534 | }; |
| 5535 | |
| 5536 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5537 | .ops = &snd_hda_bind_sw, |
| 5538 | .values = { |
| 5539 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5540 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5541 | 0 |
| 5542 | }, |
| 5543 | }; |
| 5544 | |
| 5545 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5546 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5547 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5548 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5549 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5550 | { } /* end */ |
| 5551 | }; |
| 5552 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5553 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5554 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5555 | {}, |
| 5556 | }; |
| 5557 | |
| 5558 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5559 | { |
| 5560 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5561 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5562 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5563 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5564 | } |
| 5565 | |
| 5566 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5567 | unsigned int res) |
| 5568 | { |
| 5569 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5570 | alc260_hp_3013_automute(codec); |
| 5571 | } |
| 5572 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5573 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5574 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5575 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5576 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5577 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5578 | bits); |
| 5579 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5580 | bits); |
| 5581 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5582 | bits); |
| 5583 | } |
| 5584 | |
| 5585 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5586 | unsigned int res) |
| 5587 | { |
| 5588 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5589 | alc260_hp_3012_automute(codec); |
| 5590 | } |
| 5591 | |
| 5592 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5593 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5594 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5595 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5596 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5597 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5598 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5599 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5600 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5601 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5602 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5603 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5604 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5605 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5606 | { } /* end */ |
| 5607 | }; |
| 5608 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5609 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5610 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5611 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5612 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5613 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5614 | * revisions available in early 2006. Therefore for now allow the |
| 5615 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5616 | * that the lack of mic bias for this NID is intentional we could change the |
| 5617 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5618 | * |
| 5619 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5620 | * don't appear to make the mic bias available from the "line" jack, even |
| 5621 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5622 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5623 | * and the output jack. If this turns out to be the case for all such |
| 5624 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5625 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5626 | * |
| 5627 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5628 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5629 | * controls for such models. On models without a "mono speaker" the control |
| 5630 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5631 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5632 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5633 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5634 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5635 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5636 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5637 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5638 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5639 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5640 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5641 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5642 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5643 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5644 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5645 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5646 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5647 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5648 | { } /* end */ |
| 5649 | }; |
| 5650 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5651 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5652 | */ |
| 5653 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5654 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5655 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5656 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5657 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5658 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5659 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5660 | { } /* end */ |
| 5661 | }; |
| 5662 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5663 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5664 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5665 | */ |
| 5666 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5667 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5668 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5669 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5670 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5671 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5672 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5673 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5674 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5675 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5676 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5677 | { } /* end */ |
| 5678 | }; |
| 5679 | |
| 5680 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5681 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5682 | */ |
| 5683 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5684 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5685 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5686 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5687 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5688 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5689 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5690 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5691 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5692 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5693 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5694 | { } /* end */ |
| 5695 | }; |
| 5696 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5697 | /* |
| 5698 | * initialization verbs |
| 5699 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5700 | static struct hda_verb alc260_init_verbs[] = { |
| 5701 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5702 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5703 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5704 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5705 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5706 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5707 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5708 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5709 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5710 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5711 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5712 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5713 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5714 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5715 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5716 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5717 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5718 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5719 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5720 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5721 | /* set connection select to line in (default select for this ADC) */ |
| 5722 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5723 | /* mute capture amp left and right */ |
| 5724 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5725 | /* set connection select to line in (default select for this ADC) */ |
| 5726 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5727 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5728 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5729 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5730 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5731 | /* set vol=0 HP mixer amp left and right */ |
| 5732 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5733 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5734 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5735 | /* set vol=0 Mono mixer amp left and right */ |
| 5736 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5737 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5738 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5739 | /* unmute LINE-2 out pin */ |
| 5740 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5741 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5742 | * Line In 2 = 0x03 |
| 5743 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5744 | /* mute analog inputs */ |
| 5745 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5746 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5747 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5748 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5749 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5750 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5751 | /* mute Front out path */ |
| 5752 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5753 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5754 | /* mute Headphone out path */ |
| 5755 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5756 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5757 | /* mute Mono out path */ |
| 5758 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5759 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5760 | { } |
| 5761 | }; |
| 5762 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5763 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5764 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5765 | /* Headphone and output */ |
| 5766 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5767 | /* mono output */ |
| 5768 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5769 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5770 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5771 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5772 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5773 | /* Line In pin widget for input */ |
| 5774 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5775 | /* Line-2 pin widget for output */ |
| 5776 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5777 | /* CD pin widget for input */ |
| 5778 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5779 | /* unmute amp left and right */ |
| 5780 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5781 | /* set connection select to line in (default select for this ADC) */ |
| 5782 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5783 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5784 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5785 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5786 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5787 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5788 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5789 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5790 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5791 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5792 | * Line In 2 = 0x03 |
| 5793 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5794 | /* mute analog inputs */ |
| 5795 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5796 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5797 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5798 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5799 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5800 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5801 | /* Unmute Front out path */ |
| 5802 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5803 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5804 | /* Unmute Headphone out path */ |
| 5805 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5806 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5807 | /* Unmute Mono out path */ |
| 5808 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5809 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5810 | { } |
| 5811 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5812 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5813 | |
| 5814 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5815 | /* Line out and output */ |
| 5816 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5817 | /* mono output */ |
| 5818 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5819 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5820 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5821 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5822 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5823 | /* Line In pin widget for input */ |
| 5824 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5825 | /* Headphone pin widget for output */ |
| 5826 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5827 | /* CD pin widget for input */ |
| 5828 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5829 | /* unmute amp left and right */ |
| 5830 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5831 | /* set connection select to line in (default select for this ADC) */ |
| 5832 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5833 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5834 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5835 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5836 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5837 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5838 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5839 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5840 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5841 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5842 | * Line In 2 = 0x03 |
| 5843 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5844 | /* mute analog inputs */ |
| 5845 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5846 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5847 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5848 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5849 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5850 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5851 | /* Unmute Front out path */ |
| 5852 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5853 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5854 | /* Unmute Headphone out path */ |
| 5855 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5856 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5857 | /* Unmute Mono out path */ |
| 5858 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5859 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5860 | { } |
| 5861 | }; |
| 5862 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5863 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5864 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5865 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5866 | */ |
| 5867 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5868 | /* Disable all GPIOs */ |
| 5869 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5870 | /* Internal speaker is connected to headphone pin */ |
| 5871 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5872 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5873 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5874 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5875 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5876 | /* Ensure all other unused pins are disabled and muted. */ |
| 5877 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5878 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5879 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5880 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5881 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5882 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5883 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5884 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5885 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5886 | /* Disable digital (SPDIF) pins */ |
| 5887 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5888 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5889 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5890 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5891 | * when acting as an output. |
| 5892 | */ |
| 5893 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5894 | |
| 5895 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5896 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5897 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5898 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5899 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5900 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5901 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5902 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5903 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5904 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5905 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5906 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5907 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5908 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5909 | * If the pin mode is changed by the user the pin mode control will |
| 5910 | * take care of enabling the pin's input/output buffers as needed. |
| 5911 | * Therefore there's no need to enable the input buffer at this |
| 5912 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5913 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5914 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5915 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5916 | * mixer ctrl) |
| 5917 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5918 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5919 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5920 | /* Mute capture amp left and right */ |
| 5921 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5922 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5923 | * in (on mic1 pin) |
| 5924 | */ |
| 5925 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5926 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5927 | /* Do the same for the second ADC: mute capture input amp and |
| 5928 | * set ADC connection to line in (on mic1 pin) |
| 5929 | */ |
| 5930 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5931 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5932 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5933 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5934 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5935 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5936 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5937 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5938 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5939 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5940 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5941 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5942 | |
| 5943 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5944 | }; |
| 5945 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5946 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5947 | * similar laptops (adapted from Fujitsu init verbs). |
| 5948 | */ |
| 5949 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5950 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5951 | * the headphone jack. Turn this on and rely on the standard mute |
| 5952 | * methods whenever the user wants to turn these outputs off. |
| 5953 | */ |
| 5954 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5955 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5956 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5957 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5958 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5959 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5960 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5961 | /* Line In jack is connected to Line1 pin */ |
| 5962 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5963 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5964 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5965 | /* Ensure all other unused pins are disabled and muted. */ |
| 5966 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5967 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5968 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5969 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5970 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5971 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5972 | /* Disable digital (SPDIF) pins */ |
| 5973 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5974 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5975 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5976 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5977 | * bus when acting as outputs. |
| 5978 | */ |
| 5979 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5980 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5981 | |
| 5982 | /* Start with output sum widgets muted and their output gains at min */ |
| 5983 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5984 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5985 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5986 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5987 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5988 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5989 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5990 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5991 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5992 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5993 | /* Unmute Line-out pin widget amp left and right |
| 5994 | * (no equiv mixer ctrl) |
| 5995 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5996 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5997 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5998 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5999 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6000 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6001 | * will take care of enabling the pin's input/output buffers as needed. |
| 6002 | * Therefore there's no need to enable the input buffer at this |
| 6003 | * stage. |
| 6004 | */ |
| 6005 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6006 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6007 | |
| 6008 | /* Mute capture amp left and right */ |
| 6009 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6010 | /* Set ADC connection select to match default mixer setting - mic |
| 6011 | * (on mic1 pin) |
| 6012 | */ |
| 6013 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6014 | |
| 6015 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6016 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6017 | */ |
| 6018 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6019 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6020 | |
| 6021 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6022 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6023 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6024 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6025 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6026 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6027 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6028 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6029 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6030 | |
| 6031 | { } |
| 6032 | }; |
| 6033 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6034 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6035 | * (adapted from Acer init verbs). |
| 6036 | */ |
| 6037 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6038 | /* GPIO 0 enables the output jack. |
| 6039 | * Turn this on and rely on the standard mute |
| 6040 | * methods whenever the user wants to turn these outputs off. |
| 6041 | */ |
| 6042 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6043 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6044 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6045 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6046 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6047 | /* Ensure all other unused pins are disabled and muted. */ |
| 6048 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6049 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6050 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6051 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6052 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6053 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6054 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6055 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6056 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6057 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6058 | /* Disable digital (SPDIF) pins */ |
| 6059 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6060 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6061 | |
| 6062 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6063 | * bus when acting as outputs. |
| 6064 | */ |
| 6065 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6066 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6067 | |
| 6068 | /* Start with output sum widgets muted and their output gains at min */ |
| 6069 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6070 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6071 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6072 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6073 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6074 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6075 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6076 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6077 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6078 | |
| 6079 | /* Unmute Line-out pin widget amp left and right |
| 6080 | * (no equiv mixer ctrl) |
| 6081 | */ |
| 6082 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6083 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6084 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6085 | * will take care of enabling the pin's input/output buffers as needed. |
| 6086 | * Therefore there's no need to enable the input buffer at this |
| 6087 | * stage. |
| 6088 | */ |
| 6089 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6090 | |
| 6091 | /* Mute capture amp left and right */ |
| 6092 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6093 | /* Set ADC connection select to match default mixer setting - mic |
| 6094 | * (on mic1 pin) |
| 6095 | */ |
| 6096 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6097 | |
| 6098 | /* Do similar with the second ADC: mute capture input amp and |
| 6099 | * set ADC connection to mic to match ALSA's default state. |
| 6100 | */ |
| 6101 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6102 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6103 | |
| 6104 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6105 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6106 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6107 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6108 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6109 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6110 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6111 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6112 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6113 | |
| 6114 | { } |
| 6115 | }; |
| 6116 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6117 | static struct hda_verb alc260_will_verbs[] = { |
| 6118 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6119 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6120 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6121 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6122 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6123 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6124 | {} |
| 6125 | }; |
| 6126 | |
| 6127 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6128 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6129 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6130 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6131 | |
| 6132 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6133 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6134 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6135 | |
| 6136 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6137 | {} |
| 6138 | }; |
| 6139 | |
| 6140 | /* toggle speaker-output according to the hp-jack state */ |
| 6141 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6142 | { |
| 6143 | unsigned int present; |
| 6144 | |
| 6145 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6146 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6147 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6148 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6149 | AC_VERB_SET_GPIO_DATA, 1); |
| 6150 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6151 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6152 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6153 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6154 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6155 | AC_VERB_SET_GPIO_DATA, 0); |
| 6156 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6157 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6158 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6159 | } |
| 6160 | } |
| 6161 | |
| 6162 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6163 | unsigned int res) |
| 6164 | { |
| 6165 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6166 | alc260_replacer_672v_automute(codec); |
| 6167 | } |
| 6168 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6169 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6170 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6171 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6172 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6173 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6174 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6175 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6176 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6177 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6178 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6179 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6180 | {} |
| 6181 | }; |
| 6182 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6183 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6184 | * configuration. |
| 6185 | */ |
| 6186 | #ifdef CONFIG_SND_DEBUG |
| 6187 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6188 | 0x02, |
| 6189 | }; |
| 6190 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6191 | 0x04, 0x05, |
| 6192 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6193 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6194 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6195 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6196 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6197 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6198 | { |
| 6199 | .num_items = 7, |
| 6200 | .items = { |
| 6201 | { "MIC1 pin", 0x0 }, |
| 6202 | { "MIC2 pin", 0x1 }, |
| 6203 | { "LINE1 pin", 0x2 }, |
| 6204 | { "LINE2 pin", 0x3 }, |
| 6205 | { "CD pin", 0x4 }, |
| 6206 | { "LINE-OUT pin", 0x5 }, |
| 6207 | { "HP-OUT pin", 0x6 }, |
| 6208 | }, |
| 6209 | }, |
| 6210 | { |
| 6211 | .num_items = 8, |
| 6212 | .items = { |
| 6213 | { "MIC1 pin", 0x0 }, |
| 6214 | { "MIC2 pin", 0x1 }, |
| 6215 | { "LINE1 pin", 0x2 }, |
| 6216 | { "LINE2 pin", 0x3 }, |
| 6217 | { "CD pin", 0x4 }, |
| 6218 | { "Mixer", 0x5 }, |
| 6219 | { "LINE-OUT pin", 0x6 }, |
| 6220 | { "HP-OUT pin", 0x7 }, |
| 6221 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6222 | }, |
| 6223 | }; |
| 6224 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6225 | /* Output driver widgets */ |
| 6226 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6227 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6228 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6229 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6230 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6231 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6232 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6233 | /* Modes for retasking pin widgets |
| 6234 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6235 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6236 | * mention this restriction. At this stage it's not clear whether |
| 6237 | * this behaviour is intentional or is a hardware bug in chip |
| 6238 | * revisions available at least up until early 2006. Therefore for |
| 6239 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6240 | * choices, but if it turns out that the lack of mic bias for these |
| 6241 | * NIDs is intentional we could change their modes from |
| 6242 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6243 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6244 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6245 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6246 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6247 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6248 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6249 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6250 | |
| 6251 | /* Loopback mixer controls */ |
| 6252 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6253 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6254 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6255 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6256 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6257 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6258 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6259 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6260 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6261 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6262 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6263 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6264 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6265 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6266 | |
| 6267 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6268 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6269 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6270 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6271 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6272 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6273 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6274 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6275 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6276 | */ |
| 6277 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6278 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6279 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6280 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6281 | * this output to turn on an external amplifier. |
| 6282 | */ |
| 6283 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6284 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6285 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6286 | { } /* end */ |
| 6287 | }; |
| 6288 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6289 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6290 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6291 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6292 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6293 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6294 | /* Enable retasking pins as output, initially without power amp */ |
| 6295 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6296 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6297 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6298 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6299 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6300 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6301 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6302 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6303 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6304 | * payload also sets the generation to 0, output to be in "consumer" |
| 6305 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6306 | * control. |
| 6307 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6308 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6309 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6310 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6311 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6312 | * OUT1 sum bus when acting as an output. |
| 6313 | */ |
| 6314 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6315 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6316 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6317 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6318 | |
| 6319 | /* Start with output sum widgets muted and their output gains at min */ |
| 6320 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6321 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6322 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6323 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6324 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6325 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6326 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6327 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6328 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6329 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6330 | /* Unmute retasking pin widget output buffers since the default |
| 6331 | * state appears to be output. As the pin mode is changed by the |
| 6332 | * user the pin mode control will take care of enabling the pin's |
| 6333 | * input/output buffers as needed. |
| 6334 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6335 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6336 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6337 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6338 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6339 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6340 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6341 | /* Also unmute the mono-out pin widget */ |
| 6342 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6343 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6344 | /* Mute capture amp left and right */ |
| 6345 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6346 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6347 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6348 | */ |
| 6349 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6350 | |
| 6351 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6352 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6353 | */ |
| 6354 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6355 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6356 | |
| 6357 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6358 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6359 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6360 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6361 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6362 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6363 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6364 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6365 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6366 | |
| 6367 | { } |
| 6368 | }; |
| 6369 | #endif |
| 6370 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6371 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6372 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6373 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6374 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6375 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6376 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6377 | /* |
| 6378 | * for BIOS auto-configuration |
| 6379 | */ |
| 6380 | |
| 6381 | 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] | 6382 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6383 | { |
| 6384 | hda_nid_t nid_vol; |
| 6385 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6386 | int err; |
| 6387 | |
| 6388 | if (nid >= 0x0f && nid < 0x11) { |
| 6389 | nid_vol = nid - 0x7; |
| 6390 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6391 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6392 | } else if (nid == 0x11) { |
| 6393 | nid_vol = nid - 0x7; |
| 6394 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6395 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6396 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6397 | nid_vol = 0x08; |
| 6398 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6399 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6400 | } else |
| 6401 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6402 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6403 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6404 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6405 | 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] | 6406 | if (err < 0) |
| 6407 | return err; |
| 6408 | *vol_bits |= (1 << nid_vol); |
| 6409 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6410 | 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] | 6411 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6412 | return err; |
| 6413 | return 1; |
| 6414 | } |
| 6415 | |
| 6416 | /* add playback controls from the parsed DAC table */ |
| 6417 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6418 | const struct auto_pin_cfg *cfg) |
| 6419 | { |
| 6420 | hda_nid_t nid; |
| 6421 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6422 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6423 | |
| 6424 | spec->multiout.num_dacs = 1; |
| 6425 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6426 | spec->multiout.dac_nids[0] = 0x02; |
| 6427 | |
| 6428 | nid = cfg->line_out_pins[0]; |
| 6429 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6430 | const char *pfx; |
| 6431 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6432 | pfx = "Master"; |
| 6433 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6434 | pfx = "Speaker"; |
| 6435 | else |
| 6436 | pfx = "Front"; |
| 6437 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6438 | if (err < 0) |
| 6439 | return err; |
| 6440 | } |
| 6441 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6442 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6443 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6444 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6445 | if (err < 0) |
| 6446 | return err; |
| 6447 | } |
| 6448 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6449 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6450 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6451 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6452 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6453 | if (err < 0) |
| 6454 | return err; |
| 6455 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6456 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6457 | } |
| 6458 | |
| 6459 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6460 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6461 | const struct auto_pin_cfg *cfg) |
| 6462 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6463 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6464 | } |
| 6465 | |
| 6466 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6467 | hda_nid_t nid, int pin_type, |
| 6468 | int sel_idx) |
| 6469 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6470 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6471 | /* need the manual connection? */ |
| 6472 | if (nid >= 0x12) { |
| 6473 | int idx = nid - 0x12; |
| 6474 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6475 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6476 | } |
| 6477 | } |
| 6478 | |
| 6479 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6480 | { |
| 6481 | struct alc_spec *spec = codec->spec; |
| 6482 | hda_nid_t nid; |
| 6483 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6484 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6485 | if (nid) { |
| 6486 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6487 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6488 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6489 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6490 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6491 | if (nid) |
| 6492 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6493 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6494 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6495 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6496 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6497 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6498 | |
| 6499 | #define ALC260_PIN_CD_NID 0x16 |
| 6500 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6501 | { |
| 6502 | struct alc_spec *spec = codec->spec; |
| 6503 | int i; |
| 6504 | |
| 6505 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6506 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6507 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6508 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6509 | if (nid != ALC260_PIN_CD_NID && |
| 6510 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6511 | snd_hda_codec_write(codec, nid, 0, |
| 6512 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6513 | AMP_OUT_MUTE); |
| 6514 | } |
| 6515 | } |
| 6516 | } |
| 6517 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6518 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 6519 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6520 | /* |
| 6521 | * generic initialization of ADC, input mixers and output mixers |
| 6522 | */ |
| 6523 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6524 | /* |
| 6525 | * Unmute ADC0-1 and set the default input to mic-in |
| 6526 | */ |
| 6527 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6528 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6529 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6530 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6531 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6532 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6533 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6534 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6535 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6536 | */ |
| 6537 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6538 | /* mute analog inputs */ |
| 6539 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6540 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6541 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6542 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6543 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6544 | |
| 6545 | /* |
| 6546 | * Set up output mixers (0x08 - 0x0a) |
| 6547 | */ |
| 6548 | /* set vol=0 to output mixers */ |
| 6549 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6550 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6551 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6552 | /* set up input amps for analog loopback */ |
| 6553 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6554 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6555 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6556 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6557 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6558 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6559 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6560 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6561 | { } |
| 6562 | }; |
| 6563 | |
| 6564 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6565 | { |
| 6566 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6567 | int err; |
| 6568 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6569 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6570 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6571 | alc260_ignore); |
| 6572 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6573 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6574 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6575 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6576 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6577 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6578 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6579 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6580 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6581 | return err; |
| 6582 | |
| 6583 | spec->multiout.max_channels = 2; |
| 6584 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6585 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6586 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6587 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6588 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6589 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6590 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6591 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6592 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6593 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6594 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 6595 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6596 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6597 | return 1; |
| 6598 | } |
| 6599 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6600 | /* additional initialization for auto-configuration model */ |
| 6601 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6602 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6603 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6604 | alc260_auto_init_multi_out(codec); |
| 6605 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6606 | alc260_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6607 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6608 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6609 | } |
| 6610 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6611 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6612 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6613 | { 0x07, HDA_INPUT, 0 }, |
| 6614 | { 0x07, HDA_INPUT, 1 }, |
| 6615 | { 0x07, HDA_INPUT, 2 }, |
| 6616 | { 0x07, HDA_INPUT, 3 }, |
| 6617 | { 0x07, HDA_INPUT, 4 }, |
| 6618 | { } /* end */ |
| 6619 | }; |
| 6620 | #endif |
| 6621 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6622 | /* |
| 6623 | * ALC260 configurations |
| 6624 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6625 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6626 | [ALC260_BASIC] = "basic", |
| 6627 | [ALC260_HP] = "hp", |
| 6628 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6629 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6630 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6631 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6632 | [ALC260_WILL] = "will", |
| 6633 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6634 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6635 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6636 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6637 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6638 | [ALC260_AUTO] = "auto", |
| 6639 | }; |
| 6640 | |
| 6641 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6642 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 6643 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6644 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6645 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6646 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 6647 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6648 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6649 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6650 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6651 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6652 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6653 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6654 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6655 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6656 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6657 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6658 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6659 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6660 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6661 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6662 | {} |
| 6663 | }; |
| 6664 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6665 | static struct alc_config_preset alc260_presets[] = { |
| 6666 | [ALC260_BASIC] = { |
| 6667 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6668 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6669 | .init_verbs = { alc260_init_verbs }, |
| 6670 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6671 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6672 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 6673 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6674 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6675 | .channel_mode = alc260_modes, |
| 6676 | .input_mux = &alc260_capture_source, |
| 6677 | }, |
| 6678 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6679 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6680 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6681 | .init_verbs = { alc260_init_verbs, |
| 6682 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6683 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6684 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6685 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6686 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6687 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6688 | .channel_mode = alc260_modes, |
| 6689 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6690 | .unsol_event = alc260_hp_unsol_event, |
| 6691 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6692 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6693 | [ALC260_HP_DC7600] = { |
| 6694 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6695 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6696 | .init_verbs = { alc260_init_verbs, |
| 6697 | alc260_hp_dc7600_verbs }, |
| 6698 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6699 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6700 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6701 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6702 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6703 | .channel_mode = alc260_modes, |
| 6704 | .input_mux = &alc260_capture_source, |
| 6705 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6706 | .init_hook = alc260_hp_3012_automute, |
| 6707 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6708 | [ALC260_HP_3013] = { |
| 6709 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6710 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6711 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6712 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6713 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6714 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6715 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6716 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6717 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6718 | .channel_mode = alc260_modes, |
| 6719 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6720 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6721 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6722 | }, |
| 6723 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6724 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6725 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6726 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6727 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6728 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6729 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6730 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6731 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6732 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6733 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6734 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6735 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6736 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6737 | .init_verbs = { alc260_acer_init_verbs }, |
| 6738 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6739 | .dac_nids = alc260_dac_nids, |
| 6740 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6741 | .adc_nids = alc260_dual_adc_nids, |
| 6742 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6743 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6744 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6745 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6746 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6747 | [ALC260_FAVORIT100] = { |
| 6748 | .mixers = { alc260_favorit100_mixer }, |
| 6749 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6750 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6751 | .dac_nids = alc260_dac_nids, |
| 6752 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6753 | .adc_nids = alc260_dual_adc_nids, |
| 6754 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6755 | .channel_mode = alc260_modes, |
| 6756 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6757 | .input_mux = alc260_favorit100_capture_sources, |
| 6758 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6759 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6760 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6761 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6762 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6763 | .dac_nids = alc260_dac_nids, |
| 6764 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6765 | .adc_nids = alc260_adc_nids, |
| 6766 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6767 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6768 | .channel_mode = alc260_modes, |
| 6769 | .input_mux = &alc260_capture_source, |
| 6770 | }, |
| 6771 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6772 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6773 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6774 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6775 | .dac_nids = alc260_dac_nids, |
| 6776 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6777 | .adc_nids = alc260_adc_nids, |
| 6778 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6779 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6780 | .channel_mode = alc260_modes, |
| 6781 | .input_mux = &alc260_capture_source, |
| 6782 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6783 | .init_hook = alc260_replacer_672v_automute, |
| 6784 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6785 | #ifdef CONFIG_SND_DEBUG |
| 6786 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6787 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6788 | .init_verbs = { alc260_test_init_verbs }, |
| 6789 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6790 | .dac_nids = alc260_test_dac_nids, |
| 6791 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6792 | .adc_nids = alc260_test_adc_nids, |
| 6793 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6794 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6795 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6796 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6797 | }, |
| 6798 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6799 | }; |
| 6800 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6801 | static int patch_alc260(struct hda_codec *codec) |
| 6802 | { |
| 6803 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6804 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6805 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6806 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6807 | if (spec == NULL) |
| 6808 | return -ENOMEM; |
| 6809 | |
| 6810 | codec->spec = spec; |
| 6811 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6812 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6813 | alc260_models, |
| 6814 | alc260_cfg_tbl); |
| 6815 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6816 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6817 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6818 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6819 | } |
| 6820 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6821 | if (board_config == ALC260_AUTO) { |
| 6822 | /* automatic parse from the BIOS config */ |
| 6823 | err = alc260_parse_auto_config(codec); |
| 6824 | if (err < 0) { |
| 6825 | alc_free(codec); |
| 6826 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6827 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6828 | printk(KERN_INFO |
| 6829 | "hda_codec: Cannot set up configuration " |
| 6830 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6831 | board_config = ALC260_BASIC; |
| 6832 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6833 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6834 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6835 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6836 | if (err < 0) { |
| 6837 | alc_free(codec); |
| 6838 | return err; |
| 6839 | } |
| 6840 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6841 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 6842 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6843 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6844 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6845 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6846 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6847 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6848 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6849 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6850 | if (!spec->adc_nids && spec->input_mux) { |
| 6851 | /* check whether NID 0x04 is valid */ |
| 6852 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6853 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6854 | /* get type */ |
| 6855 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6856 | spec->adc_nids = alc260_adc_nids_alt; |
| 6857 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6858 | } else { |
| 6859 | spec->adc_nids = alc260_adc_nids; |
| 6860 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6861 | } |
| 6862 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 6863 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6864 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6865 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6866 | spec->vmaster_nid = 0x08; |
| 6867 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6868 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6869 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6870 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6871 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6872 | if (!spec->loopback.amplist) |
| 6873 | spec->loopback.amplist = alc260_loopbacks; |
| 6874 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6875 | |
| 6876 | return 0; |
| 6877 | } |
| 6878 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6879 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6880 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6881 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6882 | * |
| 6883 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6884 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6885 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6886 | * 6-channel independent captures. |
| 6887 | * |
| 6888 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6889 | * driver yet). |
| 6890 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6891 | #define ALC882_DIGOUT_NID 0x06 |
| 6892 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6893 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6894 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6895 | #define ALC1200_DIGOUT_NID 0x10 |
| 6896 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6897 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6898 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6899 | { 8, NULL } |
| 6900 | }; |
| 6901 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6902 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6903 | static hda_nid_t alc882_dac_nids[4] = { |
| 6904 | /* front, rear, clfe, rear_surr */ |
| 6905 | 0x02, 0x03, 0x04, 0x05 |
| 6906 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6907 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6908 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6909 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6910 | #define alc882_adc_nids alc880_adc_nids |
| 6911 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6912 | #define alc883_adc_nids alc882_adc_nids_alt |
| 6913 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 6914 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 6915 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6916 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6917 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6918 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6919 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 6920 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 6921 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6922 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6923 | /* input MUX */ |
| 6924 | /* FIXME: should be a matrix-type input source selection */ |
| 6925 | |
| 6926 | static struct hda_input_mux alc882_capture_source = { |
| 6927 | .num_items = 4, |
| 6928 | .items = { |
| 6929 | { "Mic", 0x0 }, |
| 6930 | { "Front Mic", 0x1 }, |
| 6931 | { "Line", 0x2 }, |
| 6932 | { "CD", 0x4 }, |
| 6933 | }, |
| 6934 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6935 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6936 | #define alc883_capture_source alc882_capture_source |
| 6937 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6938 | static struct hda_input_mux alc889_capture_source = { |
| 6939 | .num_items = 3, |
| 6940 | .items = { |
| 6941 | { "Front Mic", 0x0 }, |
| 6942 | { "Mic", 0x3 }, |
| 6943 | { "Line", 0x2 }, |
| 6944 | }, |
| 6945 | }; |
| 6946 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6947 | static struct hda_input_mux mb5_capture_source = { |
| 6948 | .num_items = 3, |
| 6949 | .items = { |
| 6950 | { "Mic", 0x1 }, |
| 6951 | { "Line", 0x2 }, |
| 6952 | { "CD", 0x4 }, |
| 6953 | }, |
| 6954 | }; |
| 6955 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 6956 | static struct hda_input_mux macmini3_capture_source = { |
| 6957 | .num_items = 2, |
| 6958 | .items = { |
| 6959 | { "Line", 0x2 }, |
| 6960 | { "CD", 0x4 }, |
| 6961 | }, |
| 6962 | }; |
| 6963 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6964 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6965 | .num_items = 4, |
| 6966 | .items = { |
| 6967 | { "Mic", 0x1 }, |
| 6968 | { "Front Mic", 0x0 }, |
| 6969 | { "Line", 0x2 }, |
| 6970 | { "CD", 0x4 }, |
| 6971 | }, |
| 6972 | }; |
| 6973 | |
| 6974 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6975 | .num_items = 2, |
| 6976 | .items = { |
| 6977 | { "Mic", 0x1 }, |
| 6978 | { "Line", 0x2 }, |
| 6979 | }, |
| 6980 | }; |
| 6981 | |
| 6982 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6983 | .num_items = 4, |
| 6984 | .items = { |
| 6985 | { "Mic", 0x0 }, |
| 6986 | { "iMic", 0x1 }, |
| 6987 | { "Line", 0x2 }, |
| 6988 | { "CD", 0x4 }, |
| 6989 | }, |
| 6990 | }; |
| 6991 | |
| 6992 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6993 | .num_items = 2, |
| 6994 | .items = { |
| 6995 | { "Mic", 0x0 }, |
| 6996 | { "Int Mic", 0x1 }, |
| 6997 | }, |
| 6998 | }; |
| 6999 | |
| 7000 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7001 | .num_items = 3, |
| 7002 | .items = { |
| 7003 | { "Mic", 0x0 }, |
| 7004 | { "Front Mic", 0x1 }, |
| 7005 | { "Line", 0x4 }, |
| 7006 | }, |
| 7007 | }; |
| 7008 | |
| 7009 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7010 | .num_items = 2, |
| 7011 | .items = { |
| 7012 | { "Mic", 0x0 }, |
| 7013 | { "Line", 0x2 }, |
| 7014 | }, |
| 7015 | }; |
| 7016 | |
| 7017 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7018 | .num_items = 2, |
| 7019 | .items = { |
| 7020 | { "Mic", 0x0 }, |
| 7021 | /* Front Mic (0x01) unused */ |
| 7022 | { "Line", 0x2 }, |
| 7023 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7024 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7025 | }, |
| 7026 | }; |
| 7027 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7028 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7029 | .num_items = 2, |
| 7030 | .items = { |
| 7031 | { "Mic", 0x01 }, |
| 7032 | { "Line", 0x2 }, /* Not sure! */ |
| 7033 | }, |
| 7034 | }; |
| 7035 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7036 | /* |
| 7037 | * 2ch mode |
| 7038 | */ |
| 7039 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7040 | { 2, NULL } |
| 7041 | }; |
| 7042 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7043 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7044 | * 2ch mode |
| 7045 | */ |
| 7046 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7047 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7048 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7049 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7050 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7051 | { } /* end */ |
| 7052 | }; |
| 7053 | |
| 7054 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7055 | * 4ch mode |
| 7056 | */ |
| 7057 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7058 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7059 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7060 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7061 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7062 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7063 | { } /* end */ |
| 7064 | }; |
| 7065 | |
| 7066 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7067 | * 6ch mode |
| 7068 | */ |
| 7069 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7070 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7071 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7072 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7073 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7074 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7075 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7076 | { } /* end */ |
| 7077 | }; |
| 7078 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7079 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7080 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7081 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7082 | { 6, alc882_3ST_ch6_init }, |
| 7083 | }; |
| 7084 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7085 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7086 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7087 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7088 | * 2ch mode |
| 7089 | */ |
| 7090 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7091 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7092 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7093 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7094 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7095 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7096 | { } /* end */ |
| 7097 | }; |
| 7098 | |
| 7099 | /* |
| 7100 | * 4ch mode |
| 7101 | */ |
| 7102 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7103 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7104 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7105 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7106 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7107 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7108 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7109 | { } /* end */ |
| 7110 | }; |
| 7111 | |
| 7112 | /* |
| 7113 | * 6ch mode |
| 7114 | */ |
| 7115 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7116 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7117 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7118 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7119 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7120 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7121 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7122 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7123 | { } /* end */ |
| 7124 | }; |
| 7125 | |
| 7126 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7127 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7128 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7129 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7130 | }; |
| 7131 | |
| 7132 | |
| 7133 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7134 | * 6ch mode |
| 7135 | */ |
| 7136 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7137 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7138 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7139 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7140 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7141 | { } /* end */ |
| 7142 | }; |
| 7143 | |
| 7144 | /* |
| 7145 | * 8ch mode |
| 7146 | */ |
| 7147 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7148 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7149 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7150 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7151 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7152 | { } /* end */ |
| 7153 | }; |
| 7154 | |
| 7155 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7156 | { 6, alc882_sixstack_ch6_init }, |
| 7157 | { 8, alc882_sixstack_ch8_init }, |
| 7158 | }; |
| 7159 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7160 | |
| 7161 | /* Macbook Air 2,1 */ |
| 7162 | |
| 7163 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7164 | { 2, NULL }, |
| 7165 | }; |
| 7166 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7167 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7168 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7169 | */ |
| 7170 | |
| 7171 | /* |
| 7172 | * 2ch mode |
| 7173 | */ |
| 7174 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7175 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7176 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7177 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7178 | { } /* end */ |
| 7179 | }; |
| 7180 | |
| 7181 | /* |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7182 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7183 | */ |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7184 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7185 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7186 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7187 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7188 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7189 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7190 | { } /* end */ |
| 7191 | }; |
| 7192 | |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7193 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7194 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7195 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7196 | }; |
| 7197 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7198 | /* |
| 7199 | * 2ch |
| 7200 | * Speakers/Woofer/HP = Front |
| 7201 | * LineIn = Input |
| 7202 | */ |
| 7203 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7204 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7205 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7206 | { } /* end */ |
| 7207 | }; |
| 7208 | |
| 7209 | /* |
| 7210 | * 6ch mode |
| 7211 | * Speakers/HP = Front |
| 7212 | * Woofer = LFE |
| 7213 | * LineIn = Surround |
| 7214 | */ |
| 7215 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7216 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7217 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7218 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7219 | { } /* end */ |
| 7220 | }; |
| 7221 | |
| 7222 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7223 | { 2, alc885_mb5_ch2_init }, |
| 7224 | { 6, alc885_mb5_ch6_init }, |
| 7225 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7226 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7227 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7228 | |
| 7229 | /* |
| 7230 | * 2ch mode |
| 7231 | */ |
| 7232 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7233 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7234 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7235 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7236 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7237 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7238 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7239 | { } /* end */ |
| 7240 | }; |
| 7241 | |
| 7242 | /* |
| 7243 | * 4ch mode |
| 7244 | */ |
| 7245 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7246 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7247 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 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_OUT }, |
| 7251 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7252 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7253 | { } /* end */ |
| 7254 | }; |
| 7255 | |
| 7256 | /* |
| 7257 | * 6ch mode |
| 7258 | */ |
| 7259 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7260 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7261 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7262 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7263 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7264 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7265 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7266 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7267 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7268 | { } /* end */ |
| 7269 | }; |
| 7270 | |
| 7271 | /* |
| 7272 | * 8ch mode |
| 7273 | */ |
| 7274 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7275 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7276 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7277 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7278 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7279 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7280 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7281 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7282 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7283 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7284 | { } /* end */ |
| 7285 | }; |
| 7286 | |
| 7287 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7288 | { 2, alc883_4ST_ch2_init }, |
| 7289 | { 4, alc883_4ST_ch4_init }, |
| 7290 | { 6, alc883_4ST_ch6_init }, |
| 7291 | { 8, alc883_4ST_ch8_init }, |
| 7292 | }; |
| 7293 | |
| 7294 | |
| 7295 | /* |
| 7296 | * 2ch mode |
| 7297 | */ |
| 7298 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7299 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7300 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7301 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7302 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7303 | { } /* end */ |
| 7304 | }; |
| 7305 | |
| 7306 | /* |
| 7307 | * 4ch mode |
| 7308 | */ |
| 7309 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7310 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7311 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7312 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7313 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7314 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7315 | { } /* end */ |
| 7316 | }; |
| 7317 | |
| 7318 | /* |
| 7319 | * 6ch mode |
| 7320 | */ |
| 7321 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7322 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7323 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7324 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7325 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7326 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7327 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7328 | { } /* end */ |
| 7329 | }; |
| 7330 | |
| 7331 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7332 | { 2, alc883_3ST_ch2_intel_init }, |
| 7333 | { 4, alc883_3ST_ch4_intel_init }, |
| 7334 | { 6, alc883_3ST_ch6_intel_init }, |
| 7335 | }; |
| 7336 | |
| 7337 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7338 | * 2ch mode |
| 7339 | */ |
| 7340 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7341 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7342 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7343 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7344 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7345 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7346 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7347 | { } /* end */ |
| 7348 | }; |
| 7349 | |
| 7350 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7351 | * 6ch mode |
| 7352 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7353 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7354 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7355 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7356 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7357 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7358 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7359 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7360 | { } /* end */ |
| 7361 | }; |
| 7362 | |
| 7363 | /* |
| 7364 | * 8ch mode |
| 7365 | */ |
| 7366 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7367 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7368 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7369 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7370 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7371 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7372 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7373 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7374 | { } /* end */ |
| 7375 | }; |
| 7376 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7377 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7378 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7379 | { 6, alc889_ch6_intel_init }, |
| 7380 | { 8, alc889_ch8_intel_init }, |
| 7381 | }; |
| 7382 | |
| 7383 | /* |
| 7384 | * 6ch mode |
| 7385 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7386 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7387 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7388 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7389 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7390 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7391 | { } /* end */ |
| 7392 | }; |
| 7393 | |
| 7394 | /* |
| 7395 | * 8ch mode |
| 7396 | */ |
| 7397 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7398 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7399 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7400 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7401 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7402 | { } /* end */ |
| 7403 | }; |
| 7404 | |
| 7405 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7406 | { 6, alc883_sixstack_ch6_init }, |
| 7407 | { 8, alc883_sixstack_ch8_init }, |
| 7408 | }; |
| 7409 | |
| 7410 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7411 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7412 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7413 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7414 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7415 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7416 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7417 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7418 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7419 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7420 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7421 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7422 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7423 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7424 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7425 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7426 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7427 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7428 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7429 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7430 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7431 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7432 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7433 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7434 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7435 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7436 | { } /* end */ |
| 7437 | }; |
| 7438 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7439 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 7440 | |
| 7441 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 7442 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7443 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 7444 | { } |
| 7445 | }; |
| 7446 | |
| 7447 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7448 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7449 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7450 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7451 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7452 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7453 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7454 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7455 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7456 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7457 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7458 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7459 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7460 | { } /* end */ |
| 7461 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7462 | |
| 7463 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7464 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7465 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7466 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7467 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7468 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7469 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7470 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7471 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7472 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7473 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7474 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7475 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7476 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7477 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7478 | { } /* end */ |
| 7479 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7480 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7481 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 7482 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7483 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7484 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7485 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7486 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7487 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7488 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7489 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 7490 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7491 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 7492 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7493 | { } /* end */ |
| 7494 | }; |
| 7495 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7496 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7497 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7498 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7499 | { } /* end */ |
| 7500 | }; |
| 7501 | |
| 7502 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7503 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7504 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7505 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7506 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7507 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7508 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7509 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7510 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7511 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7512 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7513 | { } /* end */ |
| 7514 | }; |
| 7515 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7516 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7517 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7518 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7519 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7520 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7521 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7522 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7523 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7524 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7525 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7526 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7527 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7528 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7529 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7530 | { } /* end */ |
| 7531 | }; |
| 7532 | |
| 7533 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7534 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7535 | */ |
| 7536 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7537 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7538 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7539 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7540 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7541 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7542 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7543 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7544 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7545 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7546 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7547 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7548 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7549 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7550 | { } /* end */ |
| 7551 | }; |
| 7552 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7553 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7554 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7555 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7556 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7557 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7558 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7559 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7560 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7561 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7562 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7563 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7564 | { } /* end */ |
| 7565 | }; |
| 7566 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7567 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7568 | { |
| 7569 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7570 | .name = "Channel Mode", |
| 7571 | .info = alc_ch_mode_info, |
| 7572 | .get = alc_ch_mode_get, |
| 7573 | .put = alc_ch_mode_put, |
| 7574 | }, |
| 7575 | { } /* end */ |
| 7576 | }; |
| 7577 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7578 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7579 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7580 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7581 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7582 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7583 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7584 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7585 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7586 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7587 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7588 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7589 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7590 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7591 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7592 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7593 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7594 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7595 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7596 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7597 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7598 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7599 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7600 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7601 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7602 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7603 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7604 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7605 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7606 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7607 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7608 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7609 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7610 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7611 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7612 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7613 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7614 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7615 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7616 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7617 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7618 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7619 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7620 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7621 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7622 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7623 | |
| 7624 | /* FIXME: use matrix-type input source selection */ |
| 7625 | /* 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] | 7626 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7627 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7628 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7629 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7630 | /* ADC2: mute amp left and right */ |
| 7631 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7632 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7633 | /* ADC3: mute amp left and right */ |
| 7634 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7635 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7636 | |
| 7637 | { } |
| 7638 | }; |
| 7639 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7640 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7641 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7642 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7643 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7644 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7645 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7646 | /* ADC1: mute amp left and right */ |
| 7647 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7648 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7649 | { } |
| 7650 | }; |
| 7651 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7652 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7653 | /* change to EAPD mode */ |
| 7654 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7655 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7656 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7657 | }; |
| 7658 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7659 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7660 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7661 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7662 | { } |
| 7663 | }; |
| 7664 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7665 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7666 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7667 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7668 | {} |
| 7669 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7670 | |
| 7671 | static struct hda_verb alc885_init_verbs[] = { |
| 7672 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7673 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7674 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7675 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7676 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7677 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7678 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7679 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7680 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7681 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7682 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7683 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7684 | |
| 7685 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7686 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7687 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7688 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7689 | /* Front Pin: output 0 (0x0c) */ |
| 7690 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7691 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7692 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7693 | /* Rear Pin: output 1 (0x0d) */ |
| 7694 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7695 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7696 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7697 | /* CLFE Pin: output 2 (0x0e) */ |
| 7698 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7699 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7700 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7701 | /* Side Pin: output 3 (0x0f) */ |
| 7702 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7703 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7704 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7705 | /* Mic (rear) pin: input vref at 80% */ |
| 7706 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7707 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7708 | /* Front Mic pin: input vref at 80% */ |
| 7709 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7710 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7711 | /* Line In pin: input */ |
| 7712 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7713 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7714 | |
| 7715 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7716 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7717 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7718 | /* Input mixer2 */ |
| 7719 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7720 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7721 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7722 | /* ADC2: mute amp left and right */ |
| 7723 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7724 | /* ADC3: mute amp left and right */ |
| 7725 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7726 | |
| 7727 | { } |
| 7728 | }; |
| 7729 | |
| 7730 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7731 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7732 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7733 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7734 | { } |
| 7735 | }; |
| 7736 | |
| 7737 | |
| 7738 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7739 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7740 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7741 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7742 | { } |
| 7743 | }; |
| 7744 | |
| 7745 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7746 | #define alc883_init_verbs alc882_base_init_verbs |
| 7747 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7748 | /* Mac Pro test */ |
| 7749 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7750 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7751 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7752 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7753 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7754 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7755 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 7756 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7757 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7758 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7759 | { } /* end */ |
| 7760 | }; |
| 7761 | |
| 7762 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7763 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7764 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7765 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7766 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7767 | /* Front Pin: output 0 (0x0c) */ |
| 7768 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7769 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7770 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7771 | /* Front Mic pin: input vref at 80% */ |
| 7772 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7773 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7774 | /* Speaker: output */ |
| 7775 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7776 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7777 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7778 | /* Headphone output (output 0 - 0x0c) */ |
| 7779 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7780 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7781 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7782 | |
| 7783 | /* FIXME: use matrix-type input source selection */ |
| 7784 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7785 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7786 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7787 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7788 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7789 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7790 | /* Input mixer2 */ |
| 7791 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7792 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7793 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7794 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7795 | /* Input mixer3 */ |
| 7796 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7797 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7798 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7799 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7800 | /* ADC1: mute amp left and right */ |
| 7801 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7802 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7803 | /* ADC2: mute amp left and right */ |
| 7804 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7805 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7806 | /* ADC3: mute amp left and right */ |
| 7807 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7808 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7809 | |
| 7810 | { } |
| 7811 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7812 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7813 | /* Macbook 5,1 */ |
| 7814 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7815 | /* DACs */ |
| 7816 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7817 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7818 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7819 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7820 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7821 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7822 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7823 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7824 | /* Surround mixer */ |
| 7825 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7826 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7827 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7828 | /* LFE mixer */ |
| 7829 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7830 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7831 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7832 | /* HP mixer */ |
| 7833 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7834 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7835 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7836 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7837 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7838 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7839 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7840 | /* LFE Pin (0x0e) */ |
| 7841 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7842 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7843 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7844 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7845 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7846 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7847 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7848 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7849 | /* Front Mic pin: input vref at 80% */ |
| 7850 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7851 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7852 | /* Line In pin */ |
| 7853 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7854 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7855 | |
| 7856 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7857 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7858 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7859 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7860 | { } |
| 7861 | }; |
| 7862 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7863 | /* Macmini 3,1 */ |
| 7864 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 7865 | /* DACs */ |
| 7866 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7867 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7868 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7869 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7870 | /* Front mixer */ |
| 7871 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7872 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7873 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7874 | /* Surround mixer */ |
| 7875 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7876 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7877 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7878 | /* LFE mixer */ |
| 7879 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7880 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7881 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7882 | /* HP mixer */ |
| 7883 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7884 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7885 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7886 | /* Front Pin (0x0c) */ |
| 7887 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7888 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7889 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7890 | /* LFE Pin (0x0e) */ |
| 7891 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7892 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7893 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7894 | /* HP Pin (0x0f) */ |
| 7895 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7896 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7897 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7898 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7899 | /* Line In pin */ |
| 7900 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7901 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7902 | |
| 7903 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7904 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7905 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7906 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7907 | { } |
| 7908 | }; |
| 7909 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7910 | |
| 7911 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 7912 | /*Internal and HP Speaker Mixer*/ |
| 7913 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7914 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7915 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7916 | /*Internal Speaker Pin (0x0c)*/ |
| 7917 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 7918 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7919 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7920 | /* HP Pin: output 0 (0x0e) */ |
| 7921 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 7922 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7923 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7924 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 7925 | /* Line in (is hp when jack connected)*/ |
| 7926 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 7927 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7928 | |
| 7929 | { } |
| 7930 | }; |
| 7931 | |
| 7932 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7933 | /* Macbook Pro rev3 */ |
| 7934 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 7935 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7936 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7937 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7938 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7939 | /* Rear mixer */ |
| 7940 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7941 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7942 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7943 | /* HP mixer */ |
| 7944 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7945 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7946 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7947 | /* Front Pin: output 0 (0x0c) */ |
| 7948 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7949 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7950 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7951 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7952 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7953 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7954 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7955 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7956 | /* Mic (rear) pin: input vref at 80% */ |
| 7957 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7958 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7959 | /* Front Mic pin: input vref at 80% */ |
| 7960 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7961 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7962 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7963 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7964 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7965 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7966 | |
| 7967 | /* FIXME: use matrix-type input source selection */ |
| 7968 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7969 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7970 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7971 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7972 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7973 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7974 | /* Input mixer2 */ |
| 7975 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7976 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7977 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7978 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7979 | /* Input mixer3 */ |
| 7980 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7981 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7982 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7983 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7984 | /* ADC1: mute amp left and right */ |
| 7985 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7986 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7987 | /* ADC2: mute amp left and right */ |
| 7988 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7989 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7990 | /* ADC3: mute amp left and right */ |
| 7991 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7992 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7993 | |
| 7994 | { } |
| 7995 | }; |
| 7996 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7997 | /* iMac 9,1 */ |
| 7998 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7999 | /* Internal Speaker Pin (0x0c) */ |
| 8000 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8001 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8002 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8003 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8004 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8005 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8006 | /* HP Pin: Rear */ |
| 8007 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8008 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8009 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8010 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8011 | /* Line in Rear */ |
| 8012 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8013 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8014 | /* Front Mic pin: input vref at 80% */ |
| 8015 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8016 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8017 | /* Rear mixer */ |
| 8018 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8019 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8020 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8021 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 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)}, |
| 8025 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8026 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8027 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8028 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8029 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8030 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8031 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8032 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8033 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8034 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8035 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8036 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8037 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8038 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8039 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8040 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8041 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8042 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8043 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8044 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8045 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8046 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8047 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8048 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8049 | { } |
| 8050 | }; |
| 8051 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8052 | /* iMac 24 mixer. */ |
| 8053 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8054 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8055 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8056 | { } /* end */ |
| 8057 | }; |
| 8058 | |
| 8059 | /* iMac 24 init verbs. */ |
| 8060 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8061 | /* Internal speakers: output 0 (0x0c) */ |
| 8062 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8063 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8064 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8065 | /* Internal speakers: output 0 (0x0c) */ |
| 8066 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8067 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8068 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8069 | /* Headphone: output 0 (0x0c) */ |
| 8070 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8071 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8072 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8073 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8074 | /* Front Mic: input vref at 80% */ |
| 8075 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8076 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8077 | { } |
| 8078 | }; |
| 8079 | |
| 8080 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8081 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8082 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8083 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8084 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8085 | spec->autocfg.hp_pins[0] = 0x14; |
| 8086 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8087 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8088 | } |
| 8089 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8090 | #define alc885_mb5_setup alc885_imac24_setup |
| 8091 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8092 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8093 | /* Macbook Air 2,1 */ |
| 8094 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8095 | { |
| 8096 | struct alc_spec *spec = codec->spec; |
| 8097 | |
| 8098 | spec->autocfg.hp_pins[0] = 0x14; |
| 8099 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8100 | } |
| 8101 | |
| 8102 | |
| 8103 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8104 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8105 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8106 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8107 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8108 | spec->autocfg.hp_pins[0] = 0x15; |
| 8109 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8110 | } |
| 8111 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8112 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8113 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8114 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8115 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8116 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8117 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8118 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8119 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8120 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8121 | static struct hda_verb alc882_targa_verbs[] = { |
| 8122 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8123 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8124 | |
| 8125 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8126 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8127 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8128 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8129 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8130 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8131 | |
| 8132 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8133 | { } /* end */ |
| 8134 | }; |
| 8135 | |
| 8136 | /* toggle speaker-output according to the hp-jack state */ |
| 8137 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8138 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8139 | struct alc_spec *spec = codec->spec; |
| 8140 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8141 | 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] | 8142 | spec->jack_present ? 1 : 3); |
| 8143 | } |
| 8144 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8145 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8146 | { |
| 8147 | struct alc_spec *spec = codec->spec; |
| 8148 | |
| 8149 | spec->autocfg.hp_pins[0] = 0x14; |
| 8150 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8151 | } |
| 8152 | |
| 8153 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8154 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8155 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8156 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8157 | } |
| 8158 | |
| 8159 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8160 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8161 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8162 | |
| 8163 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8164 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8165 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8166 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8167 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8168 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8169 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8170 | |
| 8171 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8172 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8173 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8174 | { } /* end */ |
| 8175 | }; |
| 8176 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8177 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8178 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8179 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8180 | |
| 8181 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8182 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8183 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8184 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8185 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8186 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8187 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8188 | |
| 8189 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8190 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8191 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8192 | { } /* end */ |
| 8193 | }; |
| 8194 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8195 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8196 | { |
| 8197 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8198 | |
| 8199 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8200 | AC_VERB_GET_GPIO_DATA, 0); |
| 8201 | |
| 8202 | if (!muted) |
| 8203 | gpiostate |= (1 << pin); |
| 8204 | else |
| 8205 | gpiostate &= ~(1 << pin); |
| 8206 | |
| 8207 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8208 | AC_VERB_GET_GPIO_MASK, 0); |
| 8209 | gpiomask |= (1 << pin); |
| 8210 | |
| 8211 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8212 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8213 | gpiodir |= (1 << pin); |
| 8214 | |
| 8215 | |
| 8216 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8217 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8218 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8219 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8220 | |
| 8221 | msleep(1); |
| 8222 | |
| 8223 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8224 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8225 | } |
| 8226 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8227 | /* set up GPIO at initialization */ |
| 8228 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8229 | { |
| 8230 | alc882_gpio_mute(codec, 0, 0); |
| 8231 | alc882_gpio_mute(codec, 1, 0); |
| 8232 | } |
| 8233 | |
| 8234 | /* set up GPIO and update auto-muting at initialization */ |
| 8235 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8236 | { |
| 8237 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8238 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8239 | } |
| 8240 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8241 | /* |
| 8242 | * generic initialization of ADC, input mixers and output mixers |
| 8243 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8244 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8245 | /* |
| 8246 | * Unmute ADC0-2 and set the default input to mic-in |
| 8247 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8248 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8249 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8250 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8251 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8252 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8253 | /* |
| 8254 | * Set up output mixers (0x0c - 0x0f) |
| 8255 | */ |
| 8256 | /* set vol=0 to output mixers */ |
| 8257 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8258 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8259 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8260 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8261 | /* set up input amps for analog loopback */ |
| 8262 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8263 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8264 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8265 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8266 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8267 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8268 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8269 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8270 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8271 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8272 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8273 | |
| 8274 | /* FIXME: use matrix-type input source selection */ |
| 8275 | /* 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] | 8276 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8277 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8278 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8279 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8280 | { } |
| 8281 | }; |
| 8282 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8283 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8284 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8285 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8286 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8287 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8288 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8289 | { } /* end */ |
| 8290 | }; |
| 8291 | |
| 8292 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8293 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8294 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8295 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8296 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8297 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8298 | { } /* end */ |
| 8299 | }; |
| 8300 | |
| 8301 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8302 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8303 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8304 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8305 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8306 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8307 | { } /* end */ |
| 8308 | }; |
| 8309 | |
| 8310 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8311 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8312 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8313 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8314 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8315 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8316 | { } /* end */ |
| 8317 | }; |
| 8318 | |
| 8319 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8320 | { 2, alc889A_mb31_ch2_init }, |
| 8321 | { 4, alc889A_mb31_ch4_init }, |
| 8322 | { 5, alc889A_mb31_ch5_init }, |
| 8323 | { 6, alc889A_mb31_ch6_init }, |
| 8324 | }; |
| 8325 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8326 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8327 | /* eanable EAPD on medion laptop */ |
| 8328 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8329 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8330 | { } |
| 8331 | }; |
| 8332 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8333 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8334 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8335 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8336 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8337 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8338 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8339 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8340 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8341 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8342 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8343 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8344 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8345 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8346 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8347 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8348 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8349 | { } /* end */ |
| 8350 | }; |
| 8351 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8352 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8353 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8354 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8355 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8356 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8357 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8358 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8359 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8360 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8361 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8362 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8363 | { } /* end */ |
| 8364 | }; |
| 8365 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8366 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8367 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8368 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8369 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8370 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8371 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8372 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8373 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8374 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8375 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8376 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8377 | { } /* end */ |
| 8378 | }; |
| 8379 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8380 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8381 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8382 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8383 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8384 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8385 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8386 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8387 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8388 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8389 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8390 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8391 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8392 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8393 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8394 | { } /* end */ |
| 8395 | }; |
| 8396 | |
| 8397 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8398 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8399 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8400 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8401 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8402 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8403 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8404 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8405 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8406 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8407 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8408 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8409 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8410 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8411 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8412 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8413 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8414 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8415 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8416 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8417 | { } /* end */ |
| 8418 | }; |
| 8419 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8420 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8421 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8422 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8423 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8424 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8425 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8426 | HDA_OUTPUT), |
| 8427 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8428 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8429 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8430 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8431 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8432 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8433 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8434 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8435 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8436 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8437 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8438 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8439 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8440 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8441 | { } /* end */ |
| 8442 | }; |
| 8443 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8444 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8445 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8446 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8447 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8448 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8449 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8450 | HDA_OUTPUT), |
| 8451 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8452 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8453 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8454 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8455 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8456 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8457 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8458 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8459 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 8460 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 8461 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8462 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8463 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8464 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8465 | { } /* end */ |
| 8466 | }; |
| 8467 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8468 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8469 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8470 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8471 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8472 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8473 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8474 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8475 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8476 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8477 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8478 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8479 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8480 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8481 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8482 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8483 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8484 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8485 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8486 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8487 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8488 | { } /* end */ |
| 8489 | }; |
| 8490 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8491 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8492 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8493 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8494 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8495 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8496 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8497 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8498 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8499 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8500 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8501 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8502 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8503 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8504 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8505 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8506 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8507 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8508 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8509 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8510 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8511 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8512 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8513 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8514 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8515 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8516 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8517 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8518 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8519 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8520 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8521 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8522 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8523 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8524 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8525 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8526 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8527 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8528 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 8529 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8530 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8531 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8532 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8533 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8534 | { } /* end */ |
| 8535 | }; |
| 8536 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8537 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8538 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8539 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8540 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8541 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8542 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8543 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8544 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8545 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8546 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8547 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8548 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8549 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8550 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8551 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8552 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8553 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8554 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8555 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8556 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8557 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8558 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8559 | { } /* end */ |
| 8560 | }; |
| 8561 | |
| 8562 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8563 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8564 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8565 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8566 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8567 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8568 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8569 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8570 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8571 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8572 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8573 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8574 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 8575 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 8576 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8577 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8578 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8579 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 8580 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 8581 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 8582 | { } /* end */ |
| 8583 | }; |
| 8584 | |
| 8585 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 8586 | /* Unmute front mixer */ |
| 8587 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8588 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8589 | |
| 8590 | /* Set speaker pin to front mixer */ |
| 8591 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8592 | |
| 8593 | /* Init headphone pin */ |
| 8594 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8595 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8596 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8597 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8598 | |
| 8599 | { } /* end */ |
| 8600 | }; |
| 8601 | |
| 8602 | /* toggle speaker-output according to the hp-jack state */ |
| 8603 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 8604 | { |
| 8605 | struct alc_spec *spec = codec->spec; |
| 8606 | |
| 8607 | spec->autocfg.hp_pins[0] = 0x1a; |
| 8608 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8609 | } |
| 8610 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8611 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8612 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8613 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8614 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8615 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8616 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8617 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8618 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8619 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8620 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8621 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8622 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8623 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8624 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8625 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 8626 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8627 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8628 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8629 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8630 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8631 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8632 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8633 | { } /* end */ |
| 8634 | }; |
| 8635 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8636 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8637 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8638 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8639 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8640 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8641 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8642 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8643 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8644 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8645 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8646 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8647 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8648 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8649 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8650 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8651 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8652 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8653 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8654 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8655 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8656 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8657 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8658 | { } /* end */ |
| 8659 | }; |
| 8660 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8661 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8662 | /* Output mixers */ |
| 8663 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8664 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8665 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8666 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8667 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8668 | HDA_OUTPUT), |
| 8669 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8670 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8671 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8672 | /* Output switches */ |
| 8673 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8674 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8675 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8676 | /* Boost mixers */ |
| 8677 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8678 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8679 | /* Input mixers */ |
| 8680 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8681 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8682 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8683 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8684 | { } /* end */ |
| 8685 | }; |
| 8686 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8687 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8688 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8689 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8690 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8691 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8692 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8693 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8694 | { } /* end */ |
| 8695 | }; |
| 8696 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8697 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8698 | .ops = &snd_hda_bind_vol, |
| 8699 | .values = { |
| 8700 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8701 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8702 | 0 |
| 8703 | }, |
| 8704 | }; |
| 8705 | |
| 8706 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8707 | .ops = &snd_hda_bind_sw, |
| 8708 | .values = { |
| 8709 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8710 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8711 | 0 |
| 8712 | }, |
| 8713 | }; |
| 8714 | |
| 8715 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8716 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8717 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8718 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8719 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8720 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8721 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8722 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8723 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8724 | { } /* end */ |
| 8725 | }; |
| 8726 | |
| 8727 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8728 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8729 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8730 | { |
| 8731 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8732 | /* .name = "Capture Source", */ |
| 8733 | .name = "Input Source", |
| 8734 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8735 | .info = alc_mux_enum_info, |
| 8736 | .get = alc_mux_enum_get, |
| 8737 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8738 | }, |
| 8739 | { } /* end */ |
| 8740 | }; |
| 8741 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8742 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8743 | { |
| 8744 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8745 | .name = "Channel Mode", |
| 8746 | .info = alc_ch_mode_info, |
| 8747 | .get = alc_ch_mode_get, |
| 8748 | .put = alc_ch_mode_put, |
| 8749 | }, |
| 8750 | { } /* end */ |
| 8751 | }; |
| 8752 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8753 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8754 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8755 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8756 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8757 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8758 | spec->autocfg.hp_pins[0] = 0x15; |
| 8759 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8760 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8761 | } |
| 8762 | |
| 8763 | /* auto-toggle front mic */ |
| 8764 | /* |
| 8765 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8766 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8767 | 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] | 8768 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8769 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8770 | } |
| 8771 | */ |
| 8772 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8773 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8774 | /* HP */ |
| 8775 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8776 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8777 | /* Subwoofer */ |
| 8778 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8779 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8780 | |
| 8781 | /* enable unsolicited event */ |
| 8782 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8783 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8784 | |
| 8785 | { } /* end */ |
| 8786 | }; |
| 8787 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8788 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 8789 | /* HP */ |
| 8790 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8791 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8792 | /* Int speaker */ |
| 8793 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 8794 | |
| 8795 | /* enable unsolicited event */ |
| 8796 | /* |
| 8797 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8798 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8799 | */ |
| 8800 | |
| 8801 | { } /* end */ |
| 8802 | }; |
| 8803 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8804 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8805 | /* HP */ |
| 8806 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8807 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8808 | /* Int speaker */ |
| 8809 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8810 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8811 | |
| 8812 | /* enable unsolicited event */ |
| 8813 | {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] | 8814 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8815 | |
| 8816 | { } /* end */ |
| 8817 | }; |
| 8818 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8819 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8820 | /* HP */ |
| 8821 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8822 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8823 | /* Subwoofer */ |
| 8824 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8825 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8826 | |
| 8827 | /* enable unsolicited event */ |
| 8828 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8829 | |
| 8830 | { } /* end */ |
| 8831 | }; |
| 8832 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8833 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8834 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8835 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8836 | |
| 8837 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8838 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8839 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8840 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8841 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8842 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8843 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8844 | /* Connect Mic jack to CLFE */ |
| 8845 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8846 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8847 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8848 | /* Connect Line-in jack to Surround */ |
| 8849 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8850 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8851 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8852 | /* Connect HP out jack to Front */ |
| 8853 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8854 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8855 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8856 | |
| 8857 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8858 | |
| 8859 | { } /* end */ |
| 8860 | }; |
| 8861 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8862 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8863 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8864 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8865 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8866 | { } /* end */ |
| 8867 | }; |
| 8868 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8869 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8870 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8871 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8872 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8873 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8874 | { } /* end */ |
| 8875 | }; |
| 8876 | |
| 8877 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8878 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8879 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8880 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8881 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8882 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8883 | { } /* end */ |
| 8884 | }; |
| 8885 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8886 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8887 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8888 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8889 | |
| 8890 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8891 | |
| 8892 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8893 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8894 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8895 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8896 | { } /* end */ |
| 8897 | }; |
| 8898 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8899 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8900 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8901 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8902 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8903 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8904 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8905 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8906 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8907 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8908 | { } /* end */ |
| 8909 | }; |
| 8910 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8911 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8912 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8913 | { } |
| 8914 | }; |
| 8915 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8916 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8917 | /* HP */ |
| 8918 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8919 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8920 | |
| 8921 | /* enable unsolicited event */ |
| 8922 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8923 | |
| 8924 | { } /* end */ |
| 8925 | }; |
| 8926 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8927 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8928 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8929 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8930 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8931 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8932 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8933 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8934 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8935 | } |
| 8936 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8937 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8938 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8939 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8940 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8941 | {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] | 8942 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8943 | }; |
| 8944 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8945 | /* |
| 8946 | * 2ch mode |
| 8947 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8948 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8949 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8950 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8951 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8952 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8953 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8954 | }; |
| 8955 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8956 | /* |
| 8957 | * 4ch mode |
| 8958 | */ |
| 8959 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8960 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8961 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8962 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8963 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8964 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8965 | { } /* end */ |
| 8966 | }; |
| 8967 | |
| 8968 | /* |
| 8969 | * 6ch mode |
| 8970 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8971 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8972 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8973 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8974 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8975 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8976 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8977 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8978 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8979 | }; |
| 8980 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8981 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8982 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8983 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8984 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8985 | }; |
| 8986 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8987 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8988 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8989 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8990 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8991 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8992 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8993 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8994 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8995 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8996 | } |
| 8997 | |
| 8998 | /* toggle RCA according to the front-jack state */ |
| 8999 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 9000 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9001 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9002 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9003 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9004 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9005 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9006 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9007 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 9008 | unsigned int res) |
| 9009 | { |
| 9010 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9011 | alc888_lenovo_ms7195_front_automute(codec); |
| 9012 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9013 | alc888_lenovo_ms7195_rca_automute(codec); |
| 9014 | } |
| 9015 | |
| 9016 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 9017 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9018 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9019 | |
| 9020 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9021 | |
| 9022 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9023 | { } /* end */ |
| 9024 | }; |
| 9025 | |
| 9026 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9027 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9028 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9029 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9030 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9031 | spec->autocfg.hp_pins[0] = 0x14; |
| 9032 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9033 | } |
| 9034 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9035 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9036 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9037 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9038 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9039 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 9040 | { |
| 9041 | unsigned int present; |
| 9042 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 9043 | present = snd_hda_jack_detect(codec, 0x18); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9044 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 9045 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9046 | } |
| 9047 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9048 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9049 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9050 | struct alc_spec *spec = codec->spec; |
| 9051 | |
| 9052 | spec->autocfg.hp_pins[0] = 0x15; |
| 9053 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9054 | } |
| 9055 | |
| 9056 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9057 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9058 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9059 | alc883_clevo_m720_mic_automute(codec); |
| 9060 | } |
| 9061 | |
| 9062 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9063 | unsigned int res) |
| 9064 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9065 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9066 | case ALC880_MIC_EVENT: |
| 9067 | alc883_clevo_m720_mic_automute(codec); |
| 9068 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9069 | default: |
| 9070 | alc_automute_amp_unsol_event(codec, res); |
| 9071 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9072 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9073 | } |
| 9074 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9075 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9076 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9077 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9078 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9079 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9080 | spec->autocfg.hp_pins[0] = 0x14; |
| 9081 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9082 | } |
| 9083 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9084 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9085 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9086 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9087 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9088 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9089 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9090 | } |
| 9091 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9092 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9093 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9094 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9095 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9096 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9097 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9098 | } |
| 9099 | |
| 9100 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9101 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9102 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9103 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9104 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9105 | HDA_AMP_MUTE, bits); |
| 9106 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9107 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9108 | } |
| 9109 | |
| 9110 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9111 | unsigned int res) |
| 9112 | { |
| 9113 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9114 | alc883_lenovo_101e_all_automute(codec); |
| 9115 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9116 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9117 | } |
| 9118 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9119 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9120 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9121 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9122 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9123 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9124 | spec->autocfg.hp_pins[0] = 0x14; |
| 9125 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9126 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9127 | } |
| 9128 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9129 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9130 | /* HP Pin: output 0 (0x0c) */ |
| 9131 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9132 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9133 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9134 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9135 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9136 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9137 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9138 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9139 | /* eanable EAPD on medion laptop */ |
| 9140 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9141 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9142 | /* enable unsolicited event */ |
| 9143 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9144 | { } |
| 9145 | }; |
| 9146 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9147 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 9148 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9149 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9150 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9151 | { } /* end */ |
| 9152 | }; |
| 9153 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9154 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9155 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9156 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9157 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9158 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9159 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9160 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9161 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9162 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9163 | } |
| 9164 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9165 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9166 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9167 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9168 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9169 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9170 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9171 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9172 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9173 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9174 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9175 | } |
| 9176 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9177 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9178 | { |
| 9179 | struct alc_spec *spec = codec->spec; |
| 9180 | |
| 9181 | spec->autocfg.hp_pins[0] = 0x15; |
| 9182 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9183 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9184 | } |
| 9185 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9186 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9187 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9188 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9189 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9190 | /* enable unsolicited event */ |
| 9191 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9192 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9193 | { } /* end */ |
| 9194 | }; |
| 9195 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9196 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9197 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9198 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9199 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9200 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9201 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9202 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9203 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9204 | spec->ext_mic.pin = 0x18; |
| 9205 | spec->int_mic.pin = 0x19; |
| 9206 | spec->ext_mic.mux_idx = 0; |
| 9207 | spec->int_mic.mux_idx = 1; |
| 9208 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9209 | } |
| 9210 | |
| 9211 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9212 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9213 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9214 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9215 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9216 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9217 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9218 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9219 | /* enable unsolicited event */ |
| 9220 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9221 | { } /* end */ |
| 9222 | }; |
| 9223 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9224 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9225 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9226 | struct alc_spec *spec = codec->spec; |
| 9227 | |
| 9228 | spec->autocfg.hp_pins[0] = 0x14; |
| 9229 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9230 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9231 | } |
| 9232 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9233 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9234 | /* Init rear pin (used as headphone output) */ |
| 9235 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9236 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9237 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9238 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9239 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9240 | /* Init line 2 pin (used as headphone out by default) */ |
| 9241 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9242 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9243 | { } /* end */ |
| 9244 | }; |
| 9245 | |
| 9246 | /* Mute speakers according to the headphone jack state */ |
| 9247 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9248 | { |
| 9249 | unsigned int present; |
| 9250 | |
| 9251 | /* Mute only in 2ch or 4ch mode */ |
| 9252 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9253 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9254 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9255 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9256 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9257 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9258 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9259 | } |
| 9260 | } |
| 9261 | |
| 9262 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9263 | { |
| 9264 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9265 | alc889A_mb31_automute(codec); |
| 9266 | } |
| 9267 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9268 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9269 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9270 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9271 | #endif |
| 9272 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9273 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9274 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9275 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9276 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9277 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9278 | |
| 9279 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9280 | ALC1200_DIGOUT_NID, 0, |
| 9281 | }; |
| 9282 | |
| 9283 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9284 | ALC883_DIGOUT_NID, 0, |
| 9285 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9286 | |
| 9287 | /* |
| 9288 | * configuration and preset |
| 9289 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9290 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 9291 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9292 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9293 | [ALC882_ARIMA] = "arima", |
| 9294 | [ALC882_W2JC] = "w2jc", |
| 9295 | [ALC882_TARGA] = "targa", |
| 9296 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9297 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9298 | [ALC885_MACPRO] = "macpro", |
| 9299 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9300 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9301 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9302 | [ALC885_MBP3] = "mbp3", |
| 9303 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9304 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9305 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9306 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9307 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9308 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9309 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9310 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9311 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9312 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9313 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9314 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9315 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9316 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9317 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9318 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9319 | [ALC883_MEDION_MD2] = "medion-md2", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9320 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9321 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9322 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9323 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9324 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9325 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9326 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9327 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9328 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9329 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9330 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9331 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9332 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9333 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9334 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9335 | [ALC889A_INTEL] = "intel-alc889a", |
| 9336 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9337 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9338 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9339 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9340 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9341 | }; |
| 9342 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9343 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9344 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9345 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9346 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9347 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9348 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9349 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9350 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9351 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9352 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9353 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9354 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9355 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9356 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9357 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9358 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9359 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9360 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9361 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9362 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9363 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9364 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9365 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9366 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9367 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9368 | /* default Acer -- disabled as it causes more problems. |
| 9369 | * model=auto should work fine now |
| 9370 | */ |
| 9371 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9372 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9373 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9374 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9375 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9376 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9377 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9378 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9379 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9380 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9381 | |
| 9382 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9383 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9384 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9385 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9386 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9387 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9388 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9389 | 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] | 9390 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9391 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9392 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9393 | |
| 9394 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9395 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9396 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9397 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9398 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9399 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9400 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9401 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9402 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9403 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9404 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9405 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9406 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9407 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9408 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9409 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9410 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9411 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9412 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9413 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9414 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9415 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9416 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9417 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9418 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9419 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9420 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9421 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9422 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9423 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9424 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9425 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9426 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9427 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9428 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9429 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9430 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9431 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9432 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9433 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9434 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9435 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9436 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9437 | 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] | 9438 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9439 | 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] | 9440 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9441 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9442 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9443 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9444 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9445 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9446 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9447 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9448 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9449 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9450 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9451 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9452 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9453 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9454 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9455 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9456 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9457 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9458 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9459 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9460 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9461 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9462 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9463 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9464 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9465 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9466 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9467 | {} |
| 9468 | }; |
| 9469 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9470 | /* codec SSID table for Intel Mac */ |
| 9471 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9472 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9473 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9474 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9475 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9476 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9477 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9478 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 9479 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | f53dae2 | 2010-06-06 16:09:51 -0700 | [diff] [blame^] | 9480 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 9481 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9482 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9483 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9484 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9485 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9486 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9487 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9488 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9489 | */ |
| 9490 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9491 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9492 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9493 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9494 | }; |
| 9495 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9496 | static struct alc_config_preset alc882_presets[] = { |
| 9497 | [ALC882_3ST_DIG] = { |
| 9498 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9499 | .init_verbs = { alc882_base_init_verbs, |
| 9500 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9501 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9502 | .dac_nids = alc882_dac_nids, |
| 9503 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9504 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9505 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9506 | .channel_mode = alc882_ch_modes, |
| 9507 | .need_dac_fix = 1, |
| 9508 | .input_mux = &alc882_capture_source, |
| 9509 | }, |
| 9510 | [ALC882_6ST_DIG] = { |
| 9511 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9512 | .init_verbs = { alc882_base_init_verbs, |
| 9513 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9514 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9515 | .dac_nids = alc882_dac_nids, |
| 9516 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9517 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9518 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9519 | .channel_mode = alc882_sixstack_modes, |
| 9520 | .input_mux = &alc882_capture_source, |
| 9521 | }, |
| 9522 | [ALC882_ARIMA] = { |
| 9523 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9524 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9525 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9526 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9527 | .dac_nids = alc882_dac_nids, |
| 9528 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9529 | .channel_mode = alc882_sixstack_modes, |
| 9530 | .input_mux = &alc882_capture_source, |
| 9531 | }, |
| 9532 | [ALC882_W2JC] = { |
| 9533 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9534 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9535 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9536 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9537 | .dac_nids = alc882_dac_nids, |
| 9538 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9539 | .channel_mode = alc880_threestack_modes, |
| 9540 | .need_dac_fix = 1, |
| 9541 | .input_mux = &alc882_capture_source, |
| 9542 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9543 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9544 | [ALC885_MBA21] = { |
| 9545 | .mixers = { alc885_mba21_mixer }, |
| 9546 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 9547 | .num_dacs = 2, |
| 9548 | .dac_nids = alc882_dac_nids, |
| 9549 | .channel_mode = alc885_mba21_ch_modes, |
| 9550 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9551 | .input_mux = &alc882_capture_source, |
| 9552 | .unsol_event = alc_automute_amp_unsol_event, |
| 9553 | .setup = alc885_mba21_setup, |
| 9554 | .init_hook = alc_automute_amp, |
| 9555 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9556 | [ALC885_MBP3] = { |
| 9557 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 9558 | .init_verbs = { alc885_mbp3_init_verbs, |
| 9559 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9560 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9561 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9562 | .hp_nid = 0x04, |
| 9563 | .channel_mode = alc885_mbp_4ch_modes, |
| 9564 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9565 | .input_mux = &alc882_capture_source, |
| 9566 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9567 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9568 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9569 | .setup = alc885_mbp3_setup, |
| 9570 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9571 | }, |
| 9572 | [ALC885_MB5] = { |
| 9573 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 9574 | .init_verbs = { alc885_mb5_init_verbs, |
| 9575 | alc880_gpio1_init_verbs }, |
| 9576 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9577 | .dac_nids = alc882_dac_nids, |
| 9578 | .channel_mode = alc885_mb5_6ch_modes, |
| 9579 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 9580 | .input_mux = &mb5_capture_source, |
| 9581 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9582 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9583 | .unsol_event = alc_automute_amp_unsol_event, |
| 9584 | .setup = alc885_mb5_setup, |
| 9585 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9586 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9587 | [ALC885_MACMINI3] = { |
| 9588 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 9589 | .init_verbs = { alc885_macmini3_init_verbs, |
| 9590 | alc880_gpio1_init_verbs }, |
| 9591 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9592 | .dac_nids = alc882_dac_nids, |
| 9593 | .channel_mode = alc885_macmini3_6ch_modes, |
| 9594 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 9595 | .input_mux = &macmini3_capture_source, |
| 9596 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9597 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9598 | .unsol_event = alc_automute_amp_unsol_event, |
| 9599 | .setup = alc885_macmini3_setup, |
| 9600 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9601 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9602 | [ALC885_MACPRO] = { |
| 9603 | .mixers = { alc882_macpro_mixer }, |
| 9604 | .init_verbs = { alc882_macpro_init_verbs }, |
| 9605 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9606 | .dac_nids = alc882_dac_nids, |
| 9607 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9608 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9609 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9610 | .channel_mode = alc882_ch_modes, |
| 9611 | .input_mux = &alc882_capture_source, |
| 9612 | .init_hook = alc885_macpro_init_hook, |
| 9613 | }, |
| 9614 | [ALC885_IMAC24] = { |
| 9615 | .mixers = { alc885_imac24_mixer }, |
| 9616 | .init_verbs = { alc885_imac24_init_verbs }, |
| 9617 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9618 | .dac_nids = alc882_dac_nids, |
| 9619 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9620 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9621 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9622 | .channel_mode = alc882_ch_modes, |
| 9623 | .input_mux = &alc882_capture_source, |
| 9624 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9625 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9626 | .init_hook = alc885_imac24_init_hook, |
| 9627 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9628 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 9629 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9630 | .init_verbs = { alc885_imac91_init_verbs, |
| 9631 | alc880_gpio1_init_verbs }, |
| 9632 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9633 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 9634 | .channel_mode = alc885_mba21_ch_modes, |
| 9635 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9636 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9637 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9638 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9639 | .unsol_event = alc_automute_amp_unsol_event, |
| 9640 | .setup = alc885_imac91_setup, |
| 9641 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9642 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9643 | [ALC882_TARGA] = { |
| 9644 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9645 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 9646 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9647 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9648 | .dac_nids = alc882_dac_nids, |
| 9649 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9650 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9651 | .adc_nids = alc882_adc_nids, |
| 9652 | .capsrc_nids = alc882_capsrc_nids, |
| 9653 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9654 | .channel_mode = alc882_3ST_6ch_modes, |
| 9655 | .need_dac_fix = 1, |
| 9656 | .input_mux = &alc882_capture_source, |
| 9657 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9658 | .setup = alc882_targa_setup, |
| 9659 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9660 | }, |
| 9661 | [ALC882_ASUS_A7J] = { |
| 9662 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9663 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9664 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9665 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9666 | .dac_nids = alc882_dac_nids, |
| 9667 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9668 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9669 | .adc_nids = alc882_adc_nids, |
| 9670 | .capsrc_nids = alc882_capsrc_nids, |
| 9671 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9672 | .channel_mode = alc882_3ST_6ch_modes, |
| 9673 | .need_dac_fix = 1, |
| 9674 | .input_mux = &alc882_capture_source, |
| 9675 | }, |
| 9676 | [ALC882_ASUS_A7M] = { |
| 9677 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9678 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9679 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9680 | alc882_asus_a7m_verbs }, |
| 9681 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9682 | .dac_nids = alc882_dac_nids, |
| 9683 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9684 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9685 | .channel_mode = alc880_threestack_modes, |
| 9686 | .need_dac_fix = 1, |
| 9687 | .input_mux = &alc882_capture_source, |
| 9688 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9689 | [ALC883_3ST_2ch_DIG] = { |
| 9690 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9691 | .init_verbs = { alc883_init_verbs }, |
| 9692 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9693 | .dac_nids = alc883_dac_nids, |
| 9694 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9695 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9696 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9697 | .channel_mode = alc883_3ST_2ch_modes, |
| 9698 | .input_mux = &alc883_capture_source, |
| 9699 | }, |
| 9700 | [ALC883_3ST_6ch_DIG] = { |
| 9701 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9702 | .init_verbs = { alc883_init_verbs }, |
| 9703 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9704 | .dac_nids = alc883_dac_nids, |
| 9705 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9706 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9707 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9708 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9709 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9710 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9711 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9712 | [ALC883_3ST_6ch] = { |
| 9713 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9714 | .init_verbs = { alc883_init_verbs }, |
| 9715 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9716 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9717 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9718 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9719 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9720 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9721 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9722 | [ALC883_3ST_6ch_INTEL] = { |
| 9723 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9724 | .init_verbs = { alc883_init_verbs }, |
| 9725 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9726 | .dac_nids = alc883_dac_nids, |
| 9727 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9728 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9729 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9730 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9731 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9732 | .need_dac_fix = 1, |
| 9733 | .input_mux = &alc883_3stack_6ch_intel, |
| 9734 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9735 | [ALC889A_INTEL] = { |
| 9736 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9737 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 9738 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9739 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9740 | .dac_nids = alc883_dac_nids, |
| 9741 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9742 | .adc_nids = alc889_adc_nids, |
| 9743 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9744 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9745 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9746 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9747 | .channel_mode = alc889_8ch_intel_modes, |
| 9748 | .capsrc_nids = alc889_capsrc_nids, |
| 9749 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9750 | .setup = alc889_automute_setup, |
| 9751 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9752 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9753 | .need_dac_fix = 1, |
| 9754 | }, |
| 9755 | [ALC889_INTEL] = { |
| 9756 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9757 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9758 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9759 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9760 | .dac_nids = alc883_dac_nids, |
| 9761 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9762 | .adc_nids = alc889_adc_nids, |
| 9763 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9764 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9765 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9766 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9767 | .channel_mode = alc889_8ch_intel_modes, |
| 9768 | .capsrc_nids = alc889_capsrc_nids, |
| 9769 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9770 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9771 | .init_hook = alc889_intel_init_hook, |
| 9772 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9773 | .need_dac_fix = 1, |
| 9774 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9775 | [ALC883_6ST_DIG] = { |
| 9776 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9777 | .init_verbs = { alc883_init_verbs }, |
| 9778 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9779 | .dac_nids = alc883_dac_nids, |
| 9780 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9781 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9782 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9783 | .channel_mode = alc883_sixstack_modes, |
| 9784 | .input_mux = &alc883_capture_source, |
| 9785 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9786 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9787 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9788 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9789 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9790 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9791 | .dac_nids = alc883_dac_nids, |
| 9792 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9793 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9794 | .channel_mode = alc883_3ST_6ch_modes, |
| 9795 | .need_dac_fix = 1, |
| 9796 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9797 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9798 | .setup = alc882_targa_setup, |
| 9799 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9800 | }, |
| 9801 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9802 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9803 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9804 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9805 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9806 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9807 | .adc_nids = alc883_adc_nids_alt, |
| 9808 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9809 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9810 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9811 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9812 | .channel_mode = alc883_3ST_2ch_modes, |
| 9813 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9814 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9815 | .setup = alc882_targa_setup, |
| 9816 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9817 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9818 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9819 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 9820 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9821 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9822 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9823 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9824 | .dac_nids = alc883_dac_nids, |
| 9825 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9826 | .adc_nids = alc883_adc_nids_rev, |
| 9827 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9828 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9829 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9830 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9831 | .channel_mode = alc883_4ST_8ch_modes, |
| 9832 | .need_dac_fix = 1, |
| 9833 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9834 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9835 | .setup = alc882_targa_setup, |
| 9836 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9837 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9838 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9839 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9840 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9841 | * and the headphone jack. Turn this on and rely on the |
| 9842 | * standard mute methods whenever the user wants to turn |
| 9843 | * these outputs off. |
| 9844 | */ |
| 9845 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9846 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9847 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9848 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9849 | .channel_mode = alc883_3ST_2ch_modes, |
| 9850 | .input_mux = &alc883_capture_source, |
| 9851 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9852 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9853 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9854 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9855 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9856 | .dac_nids = alc883_dac_nids, |
| 9857 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9858 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9859 | .channel_mode = alc883_3ST_2ch_modes, |
| 9860 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9861 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9862 | .setup = alc883_acer_aspire_setup, |
| 9863 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9864 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9865 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9866 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9867 | alc883_chmode_mixer }, |
| 9868 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9869 | alc888_acer_aspire_4930g_verbs }, |
| 9870 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9871 | .dac_nids = alc883_dac_nids, |
| 9872 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9873 | .adc_nids = alc883_adc_nids_rev, |
| 9874 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9875 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9876 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9877 | .channel_mode = alc883_3ST_6ch_modes, |
| 9878 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 9879 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9880 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9881 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9882 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9883 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9884 | .setup = alc888_acer_aspire_4930g_setup, |
| 9885 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9886 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9887 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9888 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9889 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9890 | alc888_acer_aspire_6530g_verbs }, |
| 9891 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9892 | .dac_nids = alc883_dac_nids, |
| 9893 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9894 | .adc_nids = alc883_adc_nids_rev, |
| 9895 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9896 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9897 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9898 | .channel_mode = alc883_3ST_2ch_modes, |
| 9899 | .num_mux_defs = |
| 9900 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9901 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9902 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9903 | .setup = alc888_acer_aspire_6530g_setup, |
| 9904 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9905 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9906 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 9907 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9908 | alc883_chmode_mixer }, |
| 9909 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 9910 | alc889_acer_aspire_8930g_verbs, |
| 9911 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9912 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9913 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9914 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9915 | .adc_nids = alc889_adc_nids, |
| 9916 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9917 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9918 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9919 | .channel_mode = alc883_3ST_6ch_modes, |
| 9920 | .need_dac_fix = 1, |
| 9921 | .const_channel_count = 6, |
| 9922 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9923 | ARRAY_SIZE(alc889_capture_sources), |
| 9924 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9925 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9926 | .setup = alc889_acer_aspire_8930g_setup, |
| 9927 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 9928 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 9929 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 9930 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9931 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9932 | [ALC888_ACER_ASPIRE_7730G] = { |
| 9933 | .mixers = { alc883_3ST_6ch_mixer, |
| 9934 | alc883_chmode_mixer }, |
| 9935 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9936 | alc888_acer_aspire_7730G_verbs }, |
| 9937 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9938 | .dac_nids = alc883_dac_nids, |
| 9939 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9940 | .adc_nids = alc883_adc_nids_rev, |
| 9941 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9942 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9943 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9944 | .channel_mode = alc883_3ST_6ch_modes, |
| 9945 | .need_dac_fix = 1, |
| 9946 | .const_channel_count = 6, |
| 9947 | .input_mux = &alc883_capture_source, |
| 9948 | .unsol_event = alc_automute_amp_unsol_event, |
| 9949 | .setup = alc888_acer_aspire_6530g_setup, |
| 9950 | .init_hook = alc_automute_amp, |
| 9951 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9952 | [ALC883_MEDION] = { |
| 9953 | .mixers = { alc883_fivestack_mixer, |
| 9954 | alc883_chmode_mixer }, |
| 9955 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9956 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9957 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9958 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9959 | .adc_nids = alc883_adc_nids_alt, |
| 9960 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9961 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9962 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9963 | .channel_mode = alc883_sixstack_modes, |
| 9964 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9965 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9966 | [ALC883_MEDION_MD2] = { |
| 9967 | .mixers = { alc883_medion_md2_mixer}, |
| 9968 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9969 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9970 | .dac_nids = alc883_dac_nids, |
| 9971 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9972 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9973 | .channel_mode = alc883_3ST_2ch_modes, |
| 9974 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9975 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9976 | .setup = alc883_medion_md2_setup, |
| 9977 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9978 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9979 | [ALC883_MEDION_WIM2160] = { |
| 9980 | .mixers = { alc883_medion_wim2160_mixer }, |
| 9981 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 9982 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9983 | .dac_nids = alc883_dac_nids, |
| 9984 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9985 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 9986 | .adc_nids = alc883_adc_nids, |
| 9987 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9988 | .channel_mode = alc883_3ST_2ch_modes, |
| 9989 | .input_mux = &alc883_capture_source, |
| 9990 | .unsol_event = alc_automute_amp_unsol_event, |
| 9991 | .setup = alc883_medion_wim2160_setup, |
| 9992 | .init_hook = alc_automute_amp, |
| 9993 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9994 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9995 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9996 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9997 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9998 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9999 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10000 | .channel_mode = alc883_3ST_2ch_modes, |
| 10001 | .input_mux = &alc883_capture_source, |
| 10002 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10003 | [ALC883_CLEVO_M540R] = { |
| 10004 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10005 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10006 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10007 | .dac_nids = alc883_dac_nids, |
| 10008 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10009 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10010 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10011 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10012 | .need_dac_fix = 1, |
| 10013 | .input_mux = &alc883_capture_source, |
| 10014 | /* This machine has the hardware HP auto-muting, thus |
| 10015 | * we need no software mute via unsol event |
| 10016 | */ |
| 10017 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10018 | [ALC883_CLEVO_M720] = { |
| 10019 | .mixers = { alc883_clevo_m720_mixer }, |
| 10020 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10021 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10022 | .dac_nids = alc883_dac_nids, |
| 10023 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10024 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10025 | .channel_mode = alc883_3ST_2ch_modes, |
| 10026 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10027 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10028 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10029 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10030 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10031 | [ALC883_LENOVO_101E_2ch] = { |
| 10032 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10033 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10034 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10035 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10036 | .adc_nids = alc883_adc_nids_alt, |
| 10037 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10038 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10039 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10040 | .channel_mode = alc883_3ST_2ch_modes, |
| 10041 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 10042 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 10043 | .init_hook = alc883_lenovo_101e_all_automute, |
| 10044 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10045 | [ALC883_LENOVO_NB0763] = { |
| 10046 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10047 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10048 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10049 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10050 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10051 | .channel_mode = alc883_3ST_2ch_modes, |
| 10052 | .need_dac_fix = 1, |
| 10053 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10054 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10055 | .setup = alc883_medion_md2_setup, |
| 10056 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10057 | }, |
| 10058 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10059 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10060 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10061 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10062 | .dac_nids = alc883_dac_nids, |
| 10063 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10064 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10065 | .channel_mode = alc883_3ST_6ch_modes, |
| 10066 | .need_dac_fix = 1, |
| 10067 | .input_mux = &alc883_capture_source, |
| 10068 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 10069 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10070 | }, |
| 10071 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10072 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10073 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10074 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10075 | .dac_nids = alc883_dac_nids, |
| 10076 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10077 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10078 | .channel_mode = alc883_3ST_2ch_modes, |
| 10079 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10080 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10081 | .setup = alc883_haier_w66_setup, |
| 10082 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10083 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10084 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10085 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10086 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10087 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10088 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10089 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10090 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10091 | .need_dac_fix = 1, |
| 10092 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10093 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10094 | .setup = alc888_3st_hp_setup, |
| 10095 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10096 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10097 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10098 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10099 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10100 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10101 | .dac_nids = alc883_dac_nids, |
| 10102 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10103 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10104 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10105 | .channel_mode = alc883_sixstack_modes, |
| 10106 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10107 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10108 | .setup = alc888_6st_dell_setup, |
| 10109 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10110 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10111 | [ALC883_MITAC] = { |
| 10112 | .mixers = { alc883_mitac_mixer }, |
| 10113 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10114 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10115 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10116 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10117 | .channel_mode = alc883_3ST_2ch_modes, |
| 10118 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10119 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10120 | .setup = alc883_mitac_setup, |
| 10121 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10122 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10123 | [ALC883_FUJITSU_PI2515] = { |
| 10124 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10125 | .init_verbs = { alc883_init_verbs, |
| 10126 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10127 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10128 | .dac_nids = alc883_dac_nids, |
| 10129 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10130 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10131 | .channel_mode = alc883_3ST_2ch_modes, |
| 10132 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10133 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10134 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10135 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10136 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10137 | [ALC888_FUJITSU_XA3530] = { |
| 10138 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10139 | .init_verbs = { alc883_init_verbs, |
| 10140 | alc888_fujitsu_xa3530_verbs }, |
| 10141 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10142 | .dac_nids = alc883_dac_nids, |
| 10143 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10144 | .adc_nids = alc883_adc_nids_rev, |
| 10145 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10146 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10147 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10148 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10149 | .num_mux_defs = |
| 10150 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10151 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10152 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10153 | .setup = alc888_fujitsu_xa3530_setup, |
| 10154 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10155 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10156 | [ALC888_LENOVO_SKY] = { |
| 10157 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10158 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10159 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10160 | .dac_nids = alc883_dac_nids, |
| 10161 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10162 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10163 | .channel_mode = alc883_sixstack_modes, |
| 10164 | .need_dac_fix = 1, |
| 10165 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10166 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10167 | .setup = alc888_lenovo_sky_setup, |
| 10168 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10169 | }, |
| 10170 | [ALC888_ASUS_M90V] = { |
| 10171 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10172 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10173 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10174 | .dac_nids = alc883_dac_nids, |
| 10175 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10176 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10177 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10178 | .channel_mode = alc883_3ST_6ch_modes, |
| 10179 | .need_dac_fix = 1, |
| 10180 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10181 | .unsol_event = alc_sku_unsol_event, |
| 10182 | .setup = alc883_mode2_setup, |
| 10183 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10184 | }, |
| 10185 | [ALC888_ASUS_EEE1601] = { |
| 10186 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10187 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10188 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10189 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10190 | .dac_nids = alc883_dac_nids, |
| 10191 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10192 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10193 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10194 | .channel_mode = alc883_3ST_2ch_modes, |
| 10195 | .need_dac_fix = 1, |
| 10196 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10197 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10198 | .init_hook = alc883_eee1601_inithook, |
| 10199 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10200 | [ALC1200_ASUS_P5Q] = { |
| 10201 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10202 | .init_verbs = { alc883_init_verbs }, |
| 10203 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10204 | .dac_nids = alc883_dac_nids, |
| 10205 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10206 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10207 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10208 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10209 | .channel_mode = alc883_sixstack_modes, |
| 10210 | .input_mux = &alc883_capture_source, |
| 10211 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10212 | [ALC889A_MB31] = { |
| 10213 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10214 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10215 | alc880_gpio1_init_verbs }, |
| 10216 | .adc_nids = alc883_adc_nids, |
| 10217 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10218 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10219 | .dac_nids = alc883_dac_nids, |
| 10220 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10221 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10222 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10223 | .input_mux = &alc889A_mb31_capture_source, |
| 10224 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10225 | .unsol_event = alc889A_mb31_unsol_event, |
| 10226 | .init_hook = alc889A_mb31_automute, |
| 10227 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10228 | [ALC883_SONY_VAIO_TT] = { |
| 10229 | .mixers = { alc883_vaiott_mixer }, |
| 10230 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10231 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10232 | .dac_nids = alc883_dac_nids, |
| 10233 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10234 | .channel_mode = alc883_3ST_2ch_modes, |
| 10235 | .input_mux = &alc883_capture_source, |
| 10236 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10237 | .setup = alc883_vaiott_setup, |
| 10238 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10239 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10240 | }; |
| 10241 | |
| 10242 | |
| 10243 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10244 | * Pin config fixes |
| 10245 | */ |
| 10246 | enum { |
| 10247 | PINFIX_ABIT_AW9D_MAX |
| 10248 | }; |
| 10249 | |
| 10250 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 10251 | { 0x15, 0x01080104 }, /* side */ |
| 10252 | { 0x16, 0x01011012 }, /* rear */ |
| 10253 | { 0x17, 0x01016011 }, /* clfe */ |
| 10254 | { } |
| 10255 | }; |
| 10256 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10257 | static const struct alc_fixup alc882_fixups[] = { |
| 10258 | [PINFIX_ABIT_AW9D_MAX] = { |
| 10259 | .pins = alc882_abit_aw9d_pinfix |
| 10260 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10261 | }; |
| 10262 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10263 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10264 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 10265 | {} |
| 10266 | }; |
| 10267 | |
| 10268 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10269 | * BIOS auto configuration |
| 10270 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10271 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10272 | const struct auto_pin_cfg *cfg) |
| 10273 | { |
| 10274 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10275 | } |
| 10276 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10277 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10278 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10279 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10280 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10281 | int idx; |
| 10282 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10283 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10284 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10285 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10286 | if (dac == 0x25) |
| 10287 | idx = 4; |
| 10288 | else if (dac >= 0x02 && dac <= 0x05) |
| 10289 | idx = dac - 2; |
| 10290 | else |
| 10291 | return; |
| 10292 | 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] | 10293 | } |
| 10294 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10295 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10296 | { |
| 10297 | struct alc_spec *spec = codec->spec; |
| 10298 | int i; |
| 10299 | |
| 10300 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10301 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10302 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10303 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10304 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10305 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10306 | } |
| 10307 | } |
| 10308 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10309 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10310 | { |
| 10311 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10312 | hda_nid_t pin, dac; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10313 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10314 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10315 | if (pin) { |
| 10316 | dac = spec->multiout.hp_nid; |
| 10317 | if (!dac) |
| 10318 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10319 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10320 | } |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10321 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10322 | if (pin) { |
| 10323 | dac = spec->multiout.extra_out_nid[0]; |
| 10324 | if (!dac) |
| 10325 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10326 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10327 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10328 | } |
| 10329 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10330 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10331 | { |
| 10332 | struct alc_spec *spec = codec->spec; |
| 10333 | int i; |
| 10334 | |
| 10335 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10336 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10337 | if (!nid) |
| 10338 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 10339 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10340 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10341 | snd_hda_codec_write(codec, nid, 0, |
| 10342 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10343 | AMP_OUT_MUTE); |
| 10344 | } |
| 10345 | } |
| 10346 | |
| 10347 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10348 | { |
| 10349 | struct alc_spec *spec = codec->spec; |
| 10350 | int c; |
| 10351 | |
| 10352 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10353 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10354 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10355 | unsigned int mux_idx; |
| 10356 | const struct hda_input_mux *imux; |
| 10357 | int conns, mute, idx, item; |
| 10358 | |
| 10359 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10360 | ARRAY_SIZE(conn_list)); |
| 10361 | if (conns < 0) |
| 10362 | continue; |
| 10363 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10364 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10365 | if (!imux->num_items && mux_idx > 0) |
| 10366 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10367 | for (idx = 0; idx < conns; idx++) { |
| 10368 | /* if the current connection is the selected one, |
| 10369 | * unmute it as default - otherwise mute it |
| 10370 | */ |
| 10371 | mute = AMP_IN_MUTE(idx); |
| 10372 | for (item = 0; item < imux->num_items; item++) { |
| 10373 | if (imux->items[item].index == idx) { |
| 10374 | if (spec->cur_mux[c] == item) |
| 10375 | mute = AMP_IN_UNMUTE(idx); |
| 10376 | break; |
| 10377 | } |
| 10378 | } |
| 10379 | /* check if we have a selector or mixer |
| 10380 | * we could check for the widget type instead, but |
| 10381 | * just check for Amp-In presence (in case of mixer |
| 10382 | * without amp-in there is something wrong, this |
| 10383 | * function shouldn't be used or capsrc nid is wrong) |
| 10384 | */ |
| 10385 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10386 | snd_hda_codec_write(codec, nid, 0, |
| 10387 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10388 | mute); |
| 10389 | else if (mute != AMP_IN_MUTE(idx)) |
| 10390 | snd_hda_codec_write(codec, nid, 0, |
| 10391 | AC_VERB_SET_CONNECT_SEL, |
| 10392 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10393 | } |
| 10394 | } |
| 10395 | } |
| 10396 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10397 | /* add mic boosts if needed */ |
| 10398 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10399 | { |
| 10400 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10401 | int err; |
| 10402 | hda_nid_t nid; |
| 10403 | |
| 10404 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 10405 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10406 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10407 | "Mic Boost", |
| 10408 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10409 | if (err < 0) |
| 10410 | return err; |
| 10411 | } |
| 10412 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 10413 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10414 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10415 | "Front Mic Boost", |
| 10416 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10417 | if (err < 0) |
| 10418 | return err; |
| 10419 | } |
| 10420 | return 0; |
| 10421 | } |
| 10422 | |
| 10423 | /* almost identical with ALC880 parser... */ |
| 10424 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10425 | { |
| 10426 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10427 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
| 10428 | int i, err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10429 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10430 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10431 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10432 | if (err < 0) |
| 10433 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10434 | if (!spec->autocfg.line_outs) |
| 10435 | return 0; /* can't find valid BIOS pin config */ |
| 10436 | |
| 10437 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10438 | if (err < 0) |
| 10439 | return err; |
| 10440 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10441 | if (err < 0) |
| 10442 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10443 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10444 | "Headphone"); |
| 10445 | if (err < 0) |
| 10446 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10447 | err = alc880_auto_create_extra_out(spec, |
| 10448 | spec->autocfg.speaker_pins[0], |
| 10449 | "Speaker"); |
| 10450 | if (err < 0) |
| 10451 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10452 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10453 | if (err < 0) |
| 10454 | return err; |
| 10455 | |
| 10456 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10457 | |
| 10458 | /* check multiple SPDIF-out (for recent codecs) */ |
| 10459 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 10460 | hda_nid_t dig_nid; |
| 10461 | err = snd_hda_get_connections(codec, |
| 10462 | spec->autocfg.dig_out_pins[i], |
| 10463 | &dig_nid, 1); |
| 10464 | if (err < 0) |
| 10465 | continue; |
| 10466 | if (!i) |
| 10467 | spec->multiout.dig_out_nid = dig_nid; |
| 10468 | else { |
| 10469 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 10470 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10471 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 10472 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10473 | } |
| 10474 | } |
| 10475 | if (spec->autocfg.dig_in_pin) |
| 10476 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 10477 | |
| 10478 | if (spec->kctls.list) |
| 10479 | add_mixer(spec, spec->kctls.list); |
| 10480 | |
| 10481 | add_verb(spec, alc883_auto_init_verbs); |
| 10482 | /* if ADC 0x07 is available, initialize it, too */ |
| 10483 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10484 | add_verb(spec, alc882_adc1_init_verbs); |
| 10485 | |
| 10486 | spec->num_mux_defs = 1; |
| 10487 | spec->input_mux = &spec->private_imux[0]; |
| 10488 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10489 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10490 | |
| 10491 | err = alc_auto_add_mic_boost(codec); |
| 10492 | if (err < 0) |
| 10493 | return err; |
| 10494 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10495 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10496 | } |
| 10497 | |
| 10498 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10499 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10500 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10501 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10502 | alc882_auto_init_multi_out(codec); |
| 10503 | alc882_auto_init_hp_out(codec); |
| 10504 | alc882_auto_init_analog_input(codec); |
| 10505 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10506 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10507 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10508 | } |
| 10509 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10510 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10511 | { |
| 10512 | struct alc_spec *spec; |
| 10513 | int err, board_config; |
| 10514 | |
| 10515 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10516 | if (spec == NULL) |
| 10517 | return -ENOMEM; |
| 10518 | |
| 10519 | codec->spec = spec; |
| 10520 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10521 | alc_auto_parse_customize_define(codec); |
| 10522 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10523 | switch (codec->vendor_id) { |
| 10524 | case 0x10ec0882: |
| 10525 | case 0x10ec0885: |
| 10526 | break; |
| 10527 | default: |
| 10528 | /* ALC883 and variants */ |
| 10529 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10530 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10531 | } |
| 10532 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10533 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10534 | alc882_models, |
| 10535 | alc882_cfg_tbl); |
| 10536 | |
| 10537 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10538 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10539 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10540 | |
| 10541 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10542 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10543 | codec->chip_name); |
| 10544 | board_config = ALC882_AUTO; |
| 10545 | } |
| 10546 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10547 | if (board_config == ALC882_AUTO) |
| 10548 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10549 | |
| 10550 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10551 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10552 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10553 | if (err < 0) { |
| 10554 | alc_free(codec); |
| 10555 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10556 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10557 | printk(KERN_INFO |
| 10558 | "hda_codec: Cannot set up configuration " |
| 10559 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10560 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10561 | } |
| 10562 | } |
| 10563 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 10564 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 10565 | if (err < 0) { |
| 10566 | alc_free(codec); |
| 10567 | return err; |
| 10568 | } |
| 10569 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10570 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 10571 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10572 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10573 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 10574 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 10575 | /* FIXME: setup DAC5 */ |
| 10576 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 10577 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 10578 | |
| 10579 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 10580 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 10581 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10582 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10583 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10584 | spec->num_adc_nids = 0; |
| 10585 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10586 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10587 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10588 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10589 | hda_nid_t nid = alc882_adc_nids[i]; |
| 10590 | unsigned int wcap = get_wcaps(codec, nid); |
| 10591 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 10592 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10593 | if (wcap != AC_WID_AUD_IN) |
| 10594 | continue; |
| 10595 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 10596 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 10597 | if (err < 0) |
| 10598 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10599 | err = snd_hda_get_connections(codec, cap, items, |
| 10600 | ARRAY_SIZE(items)); |
| 10601 | if (err < 0) |
| 10602 | continue; |
| 10603 | for (j = 0; j < imux->num_items; j++) |
| 10604 | if (imux->items[j].index >= err) |
| 10605 | break; |
| 10606 | if (j < imux->num_items) |
| 10607 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10608 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 10609 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10610 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10611 | spec->adc_nids = spec->private_adc_nids; |
| 10612 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10613 | } |
| 10614 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 10615 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10616 | |
| 10617 | if (spec->cdefine.enable_pcbeep) |
| 10618 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10619 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10620 | if (board_config == ALC882_AUTO) |
| 10621 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); |
| 10622 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10623 | spec->vmaster_nid = 0x0c; |
| 10624 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10625 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10626 | if (board_config == ALC882_AUTO) |
| 10627 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10628 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10629 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10630 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10631 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10632 | |
| 10633 | return 0; |
| 10634 | } |
| 10635 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10636 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10637 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10638 | * ALC262 support |
| 10639 | */ |
| 10640 | |
| 10641 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 10642 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 10643 | |
| 10644 | #define alc262_dac_nids alc260_dac_nids |
| 10645 | #define alc262_adc_nids alc882_adc_nids |
| 10646 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10647 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 10648 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10649 | |
| 10650 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 10651 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10652 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10653 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 10654 | /* ADC0 */ |
| 10655 | 0x09 |
| 10656 | }; |
| 10657 | |
| 10658 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 10659 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10660 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 10661 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10662 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10663 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10664 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10665 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10666 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10667 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10668 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10669 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10670 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10671 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10672 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10673 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 10674 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10675 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 10676 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10677 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10678 | }; |
| 10679 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10680 | /* update HP, line and mono-out pins according to the master switch */ |
| 10681 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 10682 | { |
| 10683 | struct alc_spec *spec = codec->spec; |
| 10684 | int val = spec->master_sw; |
| 10685 | |
| 10686 | /* HP & line-out */ |
| 10687 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 10688 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10689 | val ? PIN_HP : 0); |
| 10690 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10691 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10692 | val ? PIN_HP : 0); |
| 10693 | /* mono (speaker) depending on the HP jack sense */ |
| 10694 | val = val && !spec->jack_present; |
| 10695 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 10696 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10697 | val ? PIN_OUT : 0); |
| 10698 | } |
| 10699 | |
| 10700 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 10701 | { |
| 10702 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10703 | |
| 10704 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10705 | alc262_hp_master_update(codec); |
| 10706 | } |
| 10707 | |
| 10708 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10709 | { |
| 10710 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10711 | return; |
| 10712 | alc262_hp_bpc_automute(codec); |
| 10713 | } |
| 10714 | |
| 10715 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 10716 | { |
| 10717 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10718 | |
| 10719 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10720 | alc262_hp_master_update(codec); |
| 10721 | } |
| 10722 | |
| 10723 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 10724 | unsigned int res) |
| 10725 | { |
| 10726 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10727 | return; |
| 10728 | alc262_hp_wildwest_automute(codec); |
| 10729 | } |
| 10730 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10731 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10732 | |
| 10733 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10734 | struct snd_ctl_elem_value *ucontrol) |
| 10735 | { |
| 10736 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10737 | struct alc_spec *spec = codec->spec; |
| 10738 | int val = !!*ucontrol->value.integer.value; |
| 10739 | |
| 10740 | if (val == spec->master_sw) |
| 10741 | return 0; |
| 10742 | spec->master_sw = val; |
| 10743 | alc262_hp_master_update(codec); |
| 10744 | return 1; |
| 10745 | } |
| 10746 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10747 | #define ALC262_HP_MASTER_SWITCH \ |
| 10748 | { \ |
| 10749 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10750 | .name = "Master Playback Switch", \ |
| 10751 | .info = snd_ctl_boolean_mono_info, \ |
| 10752 | .get = alc262_hp_master_sw_get, \ |
| 10753 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10754 | }, \ |
| 10755 | { \ |
| 10756 | .iface = NID_MAPPING, \ |
| 10757 | .name = "Master Playback Switch", \ |
| 10758 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10759 | } |
| 10760 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10761 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10762 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10763 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10764 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10765 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10766 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10767 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10768 | HDA_OUTPUT), |
| 10769 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10770 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10771 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10772 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10773 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10774 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10775 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10776 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10777 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10778 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10779 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10780 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10781 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10782 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10783 | { } /* end */ |
| 10784 | }; |
| 10785 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10786 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10787 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10788 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10789 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10790 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10791 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10792 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10793 | HDA_OUTPUT), |
| 10794 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10795 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10796 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10797 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10798 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10799 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10800 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10801 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10802 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10803 | { } /* end */ |
| 10804 | }; |
| 10805 | |
| 10806 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 10807 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10808 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10809 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10810 | { } /* end */ |
| 10811 | }; |
| 10812 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10813 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10814 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10815 | { |
| 10816 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10817 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10818 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 10819 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10820 | } |
| 10821 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10822 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10823 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10824 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10825 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10826 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10827 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10828 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10829 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10830 | { } /* end */ |
| 10831 | }; |
| 10832 | |
| 10833 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 10834 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10835 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10836 | |
| 10837 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10838 | { } |
| 10839 | }; |
| 10840 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10841 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 10842 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10843 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10844 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 10845 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10846 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10847 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10848 | { } /* end */ |
| 10849 | }; |
| 10850 | |
| 10851 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 10852 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10853 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10854 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10855 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10856 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10857 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10858 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10859 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10860 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10861 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10862 | {} |
| 10863 | }; |
| 10864 | |
| 10865 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10866 | .num_items = 1, |
| 10867 | .items = { |
| 10868 | { "Line", 0x1 }, |
| 10869 | }, |
| 10870 | }; |
| 10871 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10872 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10873 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10874 | { |
| 10875 | struct alc_spec *spec = codec->spec; |
| 10876 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10877 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10878 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10879 | unsigned int mute; |
| 10880 | |
| 10881 | /* HP */ |
| 10882 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 10883 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 10884 | HDA_AMP_MUTE, mute); |
| 10885 | /* mute internal speaker per jack sense */ |
| 10886 | if (spec->jack_present) |
| 10887 | mute = HDA_AMP_MUTE; |
| 10888 | if (line_nid) |
| 10889 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 10890 | HDA_AMP_MUTE, mute); |
| 10891 | if (speaker_nid && speaker_nid != line_nid) |
| 10892 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 10893 | HDA_AMP_MUTE, mute); |
| 10894 | } |
| 10895 | |
| 10896 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 10897 | |
| 10898 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10899 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10900 | { |
| 10901 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10902 | struct alc_spec *spec = codec->spec; |
| 10903 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10904 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10905 | if (val == spec->master_sw) |
| 10906 | return 0; |
| 10907 | spec->master_sw = val; |
| 10908 | alc262_hippo_master_update(codec); |
| 10909 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10910 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10911 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10912 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 10913 | { \ |
| 10914 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10915 | .name = "Master Playback Switch", \ |
| 10916 | .info = snd_ctl_boolean_mono_info, \ |
| 10917 | .get = alc262_hippo_master_sw_get, \ |
| 10918 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10919 | }, \ |
| 10920 | { \ |
| 10921 | .iface = NID_MAPPING, \ |
| 10922 | .name = "Master Playback Switch", \ |
| 10923 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 10924 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10925 | } |
| 10926 | |
| 10927 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 10928 | ALC262_HIPPO_MASTER_SWITCH, |
| 10929 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10930 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10931 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10932 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10933 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10934 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10935 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10936 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10937 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10938 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10939 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10940 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10941 | { } /* end */ |
| 10942 | }; |
| 10943 | |
| 10944 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 10945 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10946 | ALC262_HIPPO_MASTER_SWITCH, |
| 10947 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10948 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10949 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10950 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10951 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10952 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10953 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10954 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10955 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10956 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10957 | { } /* end */ |
| 10958 | }; |
| 10959 | |
| 10960 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10961 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 10962 | { |
| 10963 | struct alc_spec *spec = codec->spec; |
| 10964 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10965 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10966 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10967 | alc262_hippo_master_update(codec); |
| 10968 | } |
| 10969 | |
| 10970 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10971 | { |
| 10972 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10973 | return; |
| 10974 | alc262_hippo_automute(codec); |
| 10975 | } |
| 10976 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10977 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10978 | { |
| 10979 | struct alc_spec *spec = codec->spec; |
| 10980 | |
| 10981 | spec->autocfg.hp_pins[0] = 0x15; |
| 10982 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10983 | } |
| 10984 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10985 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10986 | { |
| 10987 | struct alc_spec *spec = codec->spec; |
| 10988 | |
| 10989 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10990 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10991 | } |
| 10992 | |
| 10993 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10994 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10995 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10996 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10997 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10998 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10999 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11000 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11001 | { } /* end */ |
| 11002 | }; |
| 11003 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11004 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11005 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11006 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11007 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11008 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11009 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11010 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11011 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11012 | { } /* end */ |
| 11013 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11014 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11015 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11016 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11017 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11018 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11019 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11020 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11021 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11022 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11023 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11024 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11025 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11026 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11027 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11028 | { } /* end */ |
| 11029 | }; |
| 11030 | |
| 11031 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11032 | /* Headphone automute */ |
| 11033 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11034 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11035 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11036 | |
| 11037 | /* P11 AUX_IN, white 4-pin connector */ |
| 11038 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11039 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11040 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11041 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11042 | |
| 11043 | {} |
| 11044 | }; |
| 11045 | |
| 11046 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11047 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11048 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11049 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11050 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11051 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11052 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11053 | } |
| 11054 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11055 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11056 | #define alc262_capture_mixer alc882_capture_mixer |
| 11057 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11058 | |
| 11059 | /* |
| 11060 | * generic initialization of ADC, input mixers and output mixers |
| 11061 | */ |
| 11062 | static struct hda_verb alc262_init_verbs[] = { |
| 11063 | /* |
| 11064 | * Unmute ADC0-2 and set the default input to mic-in |
| 11065 | */ |
| 11066 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11067 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11068 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11069 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11070 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11071 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11072 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11073 | /* 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] | 11074 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11075 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11076 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11077 | */ |
| 11078 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11079 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11080 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11081 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11082 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11083 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11084 | |
| 11085 | /* |
| 11086 | * Set up output mixers (0x0c - 0x0e) |
| 11087 | */ |
| 11088 | /* set vol=0 to output mixers */ |
| 11089 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11090 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11091 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11092 | /* set up input amps for analog loopback */ |
| 11093 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11094 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11095 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11096 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11097 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11098 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11099 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11100 | |
| 11101 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11102 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11103 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11104 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11105 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11106 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11107 | |
| 11108 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11109 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11110 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11111 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11112 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11113 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11114 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11115 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11116 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11117 | /* FIXME: use matrix-type input source selection */ |
| 11118 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11119 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11120 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11121 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11122 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11123 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11124 | /* Input mixer2 */ |
| 11125 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11126 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11127 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11128 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11129 | /* Input mixer3 */ |
| 11130 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11131 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11132 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11133 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11134 | |
| 11135 | { } |
| 11136 | }; |
| 11137 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11138 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11139 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11140 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11141 | { } |
| 11142 | }; |
| 11143 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11144 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11145 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11146 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11147 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11148 | |
| 11149 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11150 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11151 | {} |
| 11152 | }; |
| 11153 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11154 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11155 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11156 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11157 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11158 | |
| 11159 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11160 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11161 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11162 | }; |
| 11163 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11164 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11165 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11166 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11167 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11168 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11169 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11170 | { } /* end */ |
| 11171 | }; |
| 11172 | |
| 11173 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11174 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11175 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11176 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11177 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11178 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11179 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11180 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11181 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11182 | {} |
| 11183 | }; |
| 11184 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11185 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11186 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11187 | struct alc_spec *spec = codec->spec; |
| 11188 | |
| 11189 | spec->autocfg.hp_pins[0] = 0x15; |
| 11190 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11191 | spec->ext_mic.pin = 0x18; |
| 11192 | spec->ext_mic.mux_idx = 0; |
| 11193 | spec->int_mic.pin = 0x12; |
| 11194 | spec->int_mic.mux_idx = 9; |
| 11195 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11196 | } |
| 11197 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11198 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11199 | * nec model |
| 11200 | * 0x15 = headphone |
| 11201 | * 0x16 = internal speaker |
| 11202 | * 0x18 = external mic |
| 11203 | */ |
| 11204 | |
| 11205 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11206 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11207 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11208 | |
| 11209 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11210 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11211 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11212 | |
| 11213 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11214 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11215 | { } /* end */ |
| 11216 | }; |
| 11217 | |
| 11218 | static struct hda_verb alc262_nec_verbs[] = { |
| 11219 | /* Unmute Speaker */ |
| 11220 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11221 | |
| 11222 | /* Headphone */ |
| 11223 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11224 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11225 | |
| 11226 | /* External mic to headphone */ |
| 11227 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11228 | /* External mic to speaker */ |
| 11229 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11230 | {} |
| 11231 | }; |
| 11232 | |
| 11233 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11234 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11235 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11236 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11237 | */ |
| 11238 | |
| 11239 | #define ALC_HP_EVENT 0x37 |
| 11240 | |
| 11241 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11242 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11243 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11244 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11245 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11246 | {} |
| 11247 | }; |
| 11248 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11249 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11250 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11251 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11252 | {} |
| 11253 | }; |
| 11254 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11255 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11256 | /* Front Mic pin: input vref at 50% */ |
| 11257 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11258 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11259 | {} |
| 11260 | }; |
| 11261 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11262 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11263 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11264 | .items = { |
| 11265 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11266 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11267 | { "CD", 0x4 }, |
| 11268 | }, |
| 11269 | }; |
| 11270 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11271 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11272 | .num_items = 5, |
| 11273 | .items = { |
| 11274 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11275 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11276 | { "Line", 0x2 }, |
| 11277 | { "CD", 0x4 }, |
| 11278 | { "AUX IN", 0x6 }, |
| 11279 | }, |
| 11280 | }; |
| 11281 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11282 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11283 | .num_items = 4, |
| 11284 | .items = { |
| 11285 | { "Mic", 0x0 }, |
| 11286 | { "Front Mic", 0x2 }, |
| 11287 | { "Line", 0x1 }, |
| 11288 | { "CD", 0x4 }, |
| 11289 | }, |
| 11290 | }; |
| 11291 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11292 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11293 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11294 | { |
| 11295 | struct alc_spec *spec = codec->spec; |
| 11296 | unsigned int mute; |
| 11297 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11298 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11299 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11300 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11301 | spec->sense_updated = 1; |
| 11302 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11303 | /* unmute internal speaker only if both HPs are unplugged and |
| 11304 | * master switch is on |
| 11305 | */ |
| 11306 | if (spec->jack_present) |
| 11307 | mute = HDA_AMP_MUTE; |
| 11308 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11309 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11310 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11311 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11312 | } |
| 11313 | |
| 11314 | /* unsolicited event for HP jack sensing */ |
| 11315 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11316 | unsigned int res) |
| 11317 | { |
| 11318 | if ((res >> 26) != ALC_HP_EVENT) |
| 11319 | return; |
| 11320 | alc262_fujitsu_automute(codec, 1); |
| 11321 | } |
| 11322 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11323 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11324 | { |
| 11325 | alc262_fujitsu_automute(codec, 1); |
| 11326 | } |
| 11327 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11328 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11329 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11330 | .ops = &snd_hda_bind_vol, |
| 11331 | .values = { |
| 11332 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11333 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11334 | 0 |
| 11335 | }, |
| 11336 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11337 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11338 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11339 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11340 | { |
| 11341 | struct alc_spec *spec = codec->spec; |
| 11342 | unsigned int mute; |
| 11343 | |
| 11344 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11345 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11346 | spec->sense_updated = 1; |
| 11347 | } |
| 11348 | if (spec->jack_present) { |
| 11349 | /* mute internal speaker */ |
| 11350 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11351 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11352 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11353 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11354 | } else { |
| 11355 | /* unmute internal speaker if necessary */ |
| 11356 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11357 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11358 | HDA_AMP_MUTE, mute); |
| 11359 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11360 | HDA_AMP_MUTE, mute); |
| 11361 | } |
| 11362 | } |
| 11363 | |
| 11364 | /* unsolicited event for HP jack sensing */ |
| 11365 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11366 | unsigned int res) |
| 11367 | { |
| 11368 | if ((res >> 26) != ALC_HP_EVENT) |
| 11369 | return; |
| 11370 | alc262_lenovo_3000_automute(codec, 1); |
| 11371 | } |
| 11372 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11373 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11374 | int dir, int idx, long *valp) |
| 11375 | { |
| 11376 | int i, change = 0; |
| 11377 | |
| 11378 | for (i = 0; i < 2; i++, valp++) |
| 11379 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11380 | HDA_AMP_MUTE, |
| 11381 | *valp ? 0 : HDA_AMP_MUTE); |
| 11382 | return change; |
| 11383 | } |
| 11384 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11385 | /* bind hp and internal speaker mute (with plug check) */ |
| 11386 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11387 | struct snd_ctl_elem_value *ucontrol) |
| 11388 | { |
| 11389 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11390 | long *valp = ucontrol->value.integer.value; |
| 11391 | int change; |
| 11392 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11393 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11394 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11395 | if (change) |
| 11396 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11397 | return change; |
| 11398 | } |
| 11399 | |
| 11400 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11401 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11402 | { |
| 11403 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11404 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11405 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11406 | .info = snd_hda_mixer_amp_switch_info, |
| 11407 | .get = snd_hda_mixer_amp_switch_get, |
| 11408 | .put = alc262_fujitsu_master_sw_put, |
| 11409 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11410 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11411 | { |
| 11412 | .iface = NID_MAPPING, |
| 11413 | .name = "Master Playback Switch", |
| 11414 | .private_value = 0x1b, |
| 11415 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11416 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11417 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11418 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11419 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11420 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11421 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11422 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11423 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11424 | { } /* end */ |
| 11425 | }; |
| 11426 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11427 | /* bind hp and internal speaker mute (with plug check) */ |
| 11428 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11429 | struct snd_ctl_elem_value *ucontrol) |
| 11430 | { |
| 11431 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11432 | long *valp = ucontrol->value.integer.value; |
| 11433 | int change; |
| 11434 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11435 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11436 | if (change) |
| 11437 | alc262_lenovo_3000_automute(codec, 0); |
| 11438 | return change; |
| 11439 | } |
| 11440 | |
| 11441 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11442 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11443 | { |
| 11444 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11445 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11446 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11447 | .info = snd_hda_mixer_amp_switch_info, |
| 11448 | .get = snd_hda_mixer_amp_switch_get, |
| 11449 | .put = alc262_lenovo_3000_master_sw_put, |
| 11450 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11451 | }, |
| 11452 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11453 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11454 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11455 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11456 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11457 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11458 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11459 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11460 | { } /* end */ |
| 11461 | }; |
| 11462 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11463 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11464 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11465 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11466 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11467 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11468 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11469 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11470 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11471 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11472 | { } /* end */ |
| 11473 | }; |
| 11474 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11475 | /* additional init verbs for Benq laptops */ |
| 11476 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11477 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11478 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11479 | {} |
| 11480 | }; |
| 11481 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11482 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11483 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11484 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11485 | |
| 11486 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11487 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11488 | {} |
| 11489 | }; |
| 11490 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11491 | /* Samsung Q1 Ultra Vista model setup */ |
| 11492 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11493 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11494 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11495 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11496 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11497 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11498 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11499 | { } /* end */ |
| 11500 | }; |
| 11501 | |
| 11502 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11503 | /* output mixer */ |
| 11504 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11505 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11506 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11507 | /* speaker */ |
| 11508 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11509 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11510 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11511 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11512 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11513 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11514 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11515 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11516 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11517 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11518 | /* internal mic */ |
| 11519 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11520 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11521 | /* ADC, choose mic */ |
| 11522 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11523 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11524 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11525 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11526 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11527 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11528 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11529 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11530 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11531 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11532 | {} |
| 11533 | }; |
| 11534 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11535 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11536 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11537 | { |
| 11538 | struct alc_spec *spec = codec->spec; |
| 11539 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11540 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11541 | mute = 0; |
| 11542 | /* auto-mute only when HP is used as HP */ |
| 11543 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11544 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11545 | if (spec->jack_present) |
| 11546 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11547 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11548 | /* mute/unmute internal speaker */ |
| 11549 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11550 | HDA_AMP_MUTE, mute); |
| 11551 | /* mute/unmute HP */ |
| 11552 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11553 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11554 | } |
| 11555 | |
| 11556 | /* unsolicited event for HP jack sensing */ |
| 11557 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11558 | unsigned int res) |
| 11559 | { |
| 11560 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11561 | return; |
| 11562 | alc262_ultra_automute(codec); |
| 11563 | } |
| 11564 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11565 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 11566 | .num_items = 2, |
| 11567 | .items = { |
| 11568 | { "Mic", 0x1 }, |
| 11569 | { "Headphone", 0x7 }, |
| 11570 | }, |
| 11571 | }; |
| 11572 | |
| 11573 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11574 | struct snd_ctl_elem_value *ucontrol) |
| 11575 | { |
| 11576 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11577 | struct alc_spec *spec = codec->spec; |
| 11578 | int ret; |
| 11579 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11580 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11581 | if (!ret) |
| 11582 | return 0; |
| 11583 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 11584 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11585 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11586 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 11587 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 11588 | return ret; |
| 11589 | } |
| 11590 | |
| 11591 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 11592 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 11593 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 11594 | { |
| 11595 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11596 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11597 | .info = alc_mux_enum_info, |
| 11598 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11599 | .put = alc262_ultra_mux_enum_put, |
| 11600 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11601 | { |
| 11602 | .iface = NID_MAPPING, |
| 11603 | .name = "Capture Source", |
| 11604 | .private_value = 0x15, |
| 11605 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11606 | { } /* end */ |
| 11607 | }; |
| 11608 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11609 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 11610 | * and thus it's bound with a different mixer. |
| 11611 | * This function returns which mixer amp should be used. |
| 11612 | */ |
| 11613 | static int alc262_check_volbit(hda_nid_t nid) |
| 11614 | { |
| 11615 | if (!nid) |
| 11616 | return 0; |
| 11617 | else if (nid == 0x16) |
| 11618 | return 2; |
| 11619 | else |
| 11620 | return 1; |
| 11621 | } |
| 11622 | |
| 11623 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11624 | const char *pfx, int *vbits) |
| 11625 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11626 | unsigned long val; |
| 11627 | int vbit; |
| 11628 | |
| 11629 | vbit = alc262_check_volbit(nid); |
| 11630 | if (!vbit) |
| 11631 | return 0; |
| 11632 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 11633 | return 0; |
| 11634 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11635 | if (vbit == 2) |
| 11636 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 11637 | else |
| 11638 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11639 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11640 | } |
| 11641 | |
| 11642 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11643 | const char *pfx) |
| 11644 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11645 | unsigned long val; |
| 11646 | |
| 11647 | if (!nid) |
| 11648 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11649 | if (nid == 0x16) |
| 11650 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 11651 | else |
| 11652 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11653 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11654 | } |
| 11655 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11656 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11657 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11658 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11659 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11660 | const char *pfx; |
| 11661 | int vbits; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11662 | int err; |
| 11663 | |
| 11664 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11665 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11666 | spec->multiout.dac_nids[0] = 2; |
| 11667 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11668 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 11669 | pfx = "Master"; |
| 11670 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11671 | pfx = "Speaker"; |
| 11672 | else |
| 11673 | pfx = "Front"; |
| 11674 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); |
| 11675 | if (err < 0) |
| 11676 | return err; |
| 11677 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); |
| 11678 | if (err < 0) |
| 11679 | return err; |
| 11680 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); |
| 11681 | if (err < 0) |
| 11682 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11683 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11684 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 11685 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 11686 | alc262_check_volbit(cfg->hp_pins[0]); |
| 11687 | if (vbits == 1 || vbits == 2) |
| 11688 | pfx = "Master"; /* only one mixer is used */ |
| 11689 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11690 | pfx = "Speaker"; |
| 11691 | else |
| 11692 | pfx = "Front"; |
| 11693 | vbits = 0; |
| 11694 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); |
| 11695 | if (err < 0) |
| 11696 | return err; |
| 11697 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", |
| 11698 | &vbits); |
| 11699 | if (err < 0) |
| 11700 | return err; |
| 11701 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", |
| 11702 | &vbits); |
| 11703 | if (err < 0) |
| 11704 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11705 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11706 | } |
| 11707 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11708 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 11709 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11710 | |
| 11711 | /* |
| 11712 | * generic initialization of ADC, input mixers and output mixers |
| 11713 | */ |
| 11714 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 11715 | /* |
| 11716 | * Unmute ADC0-2 and set the default input to mic-in |
| 11717 | */ |
| 11718 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11719 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11720 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11721 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11722 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11723 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11724 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11725 | /* 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] | 11726 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11727 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11728 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11729 | */ |
| 11730 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11731 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11732 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11733 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11734 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11735 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11736 | |
| 11737 | /* |
| 11738 | * Set up output mixers (0x0c - 0x0f) |
| 11739 | */ |
| 11740 | /* set vol=0 to output mixers */ |
| 11741 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11742 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11743 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11744 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11745 | /* set up input amps for analog loopback */ |
| 11746 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11747 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11748 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11749 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11750 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11751 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11752 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11753 | |
| 11754 | /* FIXME: use matrix-type input source selection */ |
| 11755 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11756 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11757 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11758 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11759 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11760 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11761 | /* Input mixer2 */ |
| 11762 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11763 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11764 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11765 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11766 | /* Input mixer3 */ |
| 11767 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11768 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11769 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11770 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11771 | |
| 11772 | { } |
| 11773 | }; |
| 11774 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11775 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 11776 | /* |
| 11777 | * Unmute ADC0-2 and set the default input to mic-in |
| 11778 | */ |
| 11779 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11780 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11781 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11782 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11783 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11784 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11785 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11786 | /* 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] | 11787 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11788 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11789 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11790 | */ |
| 11791 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11792 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11793 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11794 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11795 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11796 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11797 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11798 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11799 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11800 | /* |
| 11801 | * Set up output mixers (0x0c - 0x0e) |
| 11802 | */ |
| 11803 | /* set vol=0 to output mixers */ |
| 11804 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11805 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11806 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11807 | |
| 11808 | /* set up input amps for analog loopback */ |
| 11809 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11810 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11811 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11812 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11813 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11814 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11815 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11816 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11817 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11818 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11819 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11820 | |
| 11821 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11822 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11823 | |
| 11824 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11825 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11826 | |
| 11827 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11828 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11829 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11830 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11831 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11832 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11833 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11834 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11835 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11836 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11837 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11838 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11839 | |
| 11840 | |
| 11841 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11842 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11843 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11844 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11845 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11846 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11847 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11848 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11849 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11850 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11851 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11852 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11853 | /* Input mixer2 */ |
| 11854 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11855 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11856 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11857 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11858 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11859 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11860 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11861 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11862 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11863 | /* Input mixer3 */ |
| 11864 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11865 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11866 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11867 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11868 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11869 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11870 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11871 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11872 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11873 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11874 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11875 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11876 | { } |
| 11877 | }; |
| 11878 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11879 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11880 | /* |
| 11881 | * Unmute ADC0-2 and set the default input to mic-in |
| 11882 | */ |
| 11883 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11884 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11885 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11886 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11887 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11888 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11889 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11890 | /* 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] | 11891 | * mixer widget |
| 11892 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11893 | * panel mic (mic 2) |
| 11894 | */ |
| 11895 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11896 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11897 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11898 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11899 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11900 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11901 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11902 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11903 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11904 | /* |
| 11905 | * Set up output mixers (0x0c - 0x0e) |
| 11906 | */ |
| 11907 | /* set vol=0 to output mixers */ |
| 11908 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11909 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11910 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11911 | |
| 11912 | /* set up input amps for analog loopback */ |
| 11913 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11914 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11915 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11916 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11917 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11918 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11919 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11920 | |
| 11921 | |
| 11922 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 11923 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 11924 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 11925 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 11926 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11927 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 11928 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 11929 | |
| 11930 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11931 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11932 | |
| 11933 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11934 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11935 | |
| 11936 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 11937 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11938 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11939 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 11940 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11941 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11942 | |
| 11943 | /* FIXME: use matrix-type input source selection */ |
| 11944 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11945 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11946 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 11947 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 11948 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 11949 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 11950 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 11951 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11952 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 11953 | /* Input mixer2 */ |
| 11954 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11955 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11956 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11957 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11958 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11959 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11960 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11961 | /* Input mixer3 */ |
| 11962 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11963 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11964 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11965 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11966 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11967 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11968 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11969 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11970 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11971 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11972 | { } |
| 11973 | }; |
| 11974 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11975 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11976 | |
| 11977 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 11978 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11979 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11980 | |
| 11981 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 11982 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11983 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11984 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11985 | |
| 11986 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11987 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11988 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11989 | {} |
| 11990 | }; |
| 11991 | |
| 11992 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11993 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11994 | #define alc262_loopbacks alc880_loopbacks |
| 11995 | #endif |
| 11996 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11997 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11998 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11999 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12000 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12001 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12002 | |
| 12003 | /* |
| 12004 | * BIOS auto configuration |
| 12005 | */ |
| 12006 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12007 | { |
| 12008 | struct alc_spec *spec = codec->spec; |
| 12009 | int err; |
| 12010 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12011 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12012 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12013 | alc262_ignore); |
| 12014 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12015 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12016 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12017 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12018 | spec->multiout.max_channels = 2; |
| 12019 | spec->no_analog = 1; |
| 12020 | goto dig_only; |
| 12021 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12022 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12023 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12024 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12025 | if (err < 0) |
| 12026 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12027 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12028 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12029 | return err; |
| 12030 | |
| 12031 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12032 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12033 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12034 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12035 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12036 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12037 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12038 | if (spec->autocfg.dig_in_pin) |
| 12039 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 12040 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12041 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12042 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12043 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12044 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12045 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12046 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12047 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12048 | err = alc_auto_add_mic_boost(codec); |
| 12049 | if (err < 0) |
| 12050 | return err; |
| 12051 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12052 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12053 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12054 | return 1; |
| 12055 | } |
| 12056 | |
| 12057 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12058 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12059 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12060 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12061 | |
| 12062 | |
| 12063 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12064 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12065 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12066 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12067 | alc262_auto_init_multi_out(codec); |
| 12068 | alc262_auto_init_hp_out(codec); |
| 12069 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12070 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12071 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12072 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12073 | } |
| 12074 | |
| 12075 | /* |
| 12076 | * configuration and preset |
| 12077 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12078 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 12079 | [ALC262_BASIC] = "basic", |
| 12080 | [ALC262_HIPPO] = "hippo", |
| 12081 | [ALC262_HIPPO_1] = "hippo_1", |
| 12082 | [ALC262_FUJITSU] = "fujitsu", |
| 12083 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12084 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12085 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12086 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12087 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12088 | [ALC262_BENQ_T31] = "benq-t31", |
| 12089 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12090 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12091 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12092 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12093 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12094 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12095 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12096 | [ALC262_AUTO] = "auto", |
| 12097 | }; |
| 12098 | |
| 12099 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12100 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12101 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12102 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12103 | ALC262_HP_BPC), |
| 12104 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12105 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12106 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12107 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12108 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12109 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12110 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12111 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12112 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12113 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12114 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12115 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12116 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12117 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12118 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12119 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12120 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12121 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12122 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12123 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12124 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12125 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12126 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12127 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12128 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12129 | #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] | 12130 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12131 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12132 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12133 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12134 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12135 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12136 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12137 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12138 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12139 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12140 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12141 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12142 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12143 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12144 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12145 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12146 | {} |
| 12147 | }; |
| 12148 | |
| 12149 | static struct alc_config_preset alc262_presets[] = { |
| 12150 | [ALC262_BASIC] = { |
| 12151 | .mixers = { alc262_base_mixer }, |
| 12152 | .init_verbs = { alc262_init_verbs }, |
| 12153 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12154 | .dac_nids = alc262_dac_nids, |
| 12155 | .hp_nid = 0x03, |
| 12156 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12157 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12158 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12159 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12160 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12161 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12162 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12163 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12164 | .dac_nids = alc262_dac_nids, |
| 12165 | .hp_nid = 0x03, |
| 12166 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12167 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12168 | .channel_mode = alc262_modes, |
| 12169 | .input_mux = &alc262_capture_source, |
| 12170 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12171 | .setup = alc262_hippo_setup, |
| 12172 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12173 | }, |
| 12174 | [ALC262_HIPPO_1] = { |
| 12175 | .mixers = { alc262_hippo1_mixer }, |
| 12176 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12177 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12178 | .dac_nids = alc262_dac_nids, |
| 12179 | .hp_nid = 0x02, |
| 12180 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12181 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12182 | .channel_mode = alc262_modes, |
| 12183 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12184 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12185 | .setup = alc262_hippo1_setup, |
| 12186 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12187 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12188 | [ALC262_FUJITSU] = { |
| 12189 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12190 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12191 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12192 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12193 | .dac_nids = alc262_dac_nids, |
| 12194 | .hp_nid = 0x03, |
| 12195 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12196 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12197 | .channel_mode = alc262_modes, |
| 12198 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12199 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12200 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12201 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12202 | [ALC262_HP_BPC] = { |
| 12203 | .mixers = { alc262_HP_BPC_mixer }, |
| 12204 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12205 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12206 | .dac_nids = alc262_dac_nids, |
| 12207 | .hp_nid = 0x03, |
| 12208 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12209 | .channel_mode = alc262_modes, |
| 12210 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12211 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12212 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12213 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12214 | [ALC262_HP_BPC_D7000_WF] = { |
| 12215 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12216 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12217 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12218 | .dac_nids = alc262_dac_nids, |
| 12219 | .hp_nid = 0x03, |
| 12220 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12221 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12222 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12223 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12224 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12225 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12226 | [ALC262_HP_BPC_D7000_WL] = { |
| 12227 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12228 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12229 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12230 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12231 | .dac_nids = alc262_dac_nids, |
| 12232 | .hp_nid = 0x03, |
| 12233 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12234 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12235 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12236 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12237 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12238 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12239 | [ALC262_HP_TC_T5735] = { |
| 12240 | .mixers = { alc262_hp_t5735_mixer }, |
| 12241 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12242 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12243 | .dac_nids = alc262_dac_nids, |
| 12244 | .hp_nid = 0x03, |
| 12245 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12246 | .channel_mode = alc262_modes, |
| 12247 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12248 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12249 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12250 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12251 | }, |
| 12252 | [ALC262_HP_RP5700] = { |
| 12253 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12254 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12255 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12256 | .dac_nids = alc262_dac_nids, |
| 12257 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12258 | .channel_mode = alc262_modes, |
| 12259 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12260 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12261 | [ALC262_BENQ_ED8] = { |
| 12262 | .mixers = { alc262_base_mixer }, |
| 12263 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12264 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12265 | .dac_nids = alc262_dac_nids, |
| 12266 | .hp_nid = 0x03, |
| 12267 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12268 | .channel_mode = alc262_modes, |
| 12269 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12270 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12271 | [ALC262_SONY_ASSAMD] = { |
| 12272 | .mixers = { alc262_sony_mixer }, |
| 12273 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12274 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12275 | .dac_nids = alc262_dac_nids, |
| 12276 | .hp_nid = 0x02, |
| 12277 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12278 | .channel_mode = alc262_modes, |
| 12279 | .input_mux = &alc262_capture_source, |
| 12280 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12281 | .setup = alc262_hippo_setup, |
| 12282 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12283 | }, |
| 12284 | [ALC262_BENQ_T31] = { |
| 12285 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12286 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12287 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12288 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12289 | .dac_nids = alc262_dac_nids, |
| 12290 | .hp_nid = 0x03, |
| 12291 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12292 | .channel_mode = alc262_modes, |
| 12293 | .input_mux = &alc262_capture_source, |
| 12294 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12295 | .setup = alc262_hippo_setup, |
| 12296 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12297 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12298 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12299 | .mixers = { alc262_ultra_mixer }, |
| 12300 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12301 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12302 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12303 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12304 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12305 | .channel_mode = alc262_modes, |
| 12306 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12307 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12308 | .capsrc_nids = alc262_capsrc_nids, |
| 12309 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12310 | .unsol_event = alc262_ultra_unsol_event, |
| 12311 | .init_hook = alc262_ultra_automute, |
| 12312 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12313 | [ALC262_LENOVO_3000] = { |
| 12314 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12315 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12316 | alc262_lenovo_3000_unsol_verbs, |
| 12317 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12318 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12319 | .dac_nids = alc262_dac_nids, |
| 12320 | .hp_nid = 0x03, |
| 12321 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12322 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12323 | .channel_mode = alc262_modes, |
| 12324 | .input_mux = &alc262_fujitsu_capture_source, |
| 12325 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12326 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12327 | [ALC262_NEC] = { |
| 12328 | .mixers = { alc262_nec_mixer }, |
| 12329 | .init_verbs = { alc262_nec_verbs }, |
| 12330 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12331 | .dac_nids = alc262_dac_nids, |
| 12332 | .hp_nid = 0x03, |
| 12333 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12334 | .channel_mode = alc262_modes, |
| 12335 | .input_mux = &alc262_capture_source, |
| 12336 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12337 | [ALC262_TOSHIBA_S06] = { |
| 12338 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12339 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12340 | alc262_eapd_verbs }, |
| 12341 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12342 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12343 | .dac_nids = alc262_dac_nids, |
| 12344 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12345 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12346 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12347 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12348 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12349 | .unsol_event = alc_sku_unsol_event, |
| 12350 | .setup = alc262_toshiba_s06_setup, |
| 12351 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12352 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12353 | [ALC262_TOSHIBA_RX1] = { |
| 12354 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12355 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12356 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12357 | .dac_nids = alc262_dac_nids, |
| 12358 | .hp_nid = 0x03, |
| 12359 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12360 | .channel_mode = alc262_modes, |
| 12361 | .input_mux = &alc262_capture_source, |
| 12362 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12363 | .setup = alc262_hippo_setup, |
| 12364 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12365 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12366 | [ALC262_TYAN] = { |
| 12367 | .mixers = { alc262_tyan_mixer }, |
| 12368 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12369 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12370 | .dac_nids = alc262_dac_nids, |
| 12371 | .hp_nid = 0x02, |
| 12372 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12373 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12374 | .channel_mode = alc262_modes, |
| 12375 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12376 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12377 | .setup = alc262_tyan_setup, |
| 12378 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12379 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12380 | }; |
| 12381 | |
| 12382 | static int patch_alc262(struct hda_codec *codec) |
| 12383 | { |
| 12384 | struct alc_spec *spec; |
| 12385 | int board_config; |
| 12386 | int err; |
| 12387 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12388 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12389 | if (spec == NULL) |
| 12390 | return -ENOMEM; |
| 12391 | |
| 12392 | codec->spec = spec; |
| 12393 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12394 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12395 | * under-run |
| 12396 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12397 | { |
| 12398 | int tmp; |
| 12399 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12400 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12401 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12402 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12403 | } |
| 12404 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12405 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12406 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12407 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12408 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12409 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12410 | alc262_models, |
| 12411 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12412 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12413 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12414 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12415 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12416 | board_config = ALC262_AUTO; |
| 12417 | } |
| 12418 | |
| 12419 | if (board_config == ALC262_AUTO) { |
| 12420 | /* automatic parse from the BIOS config */ |
| 12421 | err = alc262_parse_auto_config(codec); |
| 12422 | if (err < 0) { |
| 12423 | alc_free(codec); |
| 12424 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12425 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12426 | printk(KERN_INFO |
| 12427 | "hda_codec: Cannot set up configuration " |
| 12428 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12429 | board_config = ALC262_BASIC; |
| 12430 | } |
| 12431 | } |
| 12432 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12433 | if (!spec->no_analog) { |
| 12434 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12435 | if (err < 0) { |
| 12436 | alc_free(codec); |
| 12437 | return err; |
| 12438 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12439 | } |
| 12440 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12441 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12442 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12443 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12444 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12445 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12446 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12447 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12448 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12449 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12450 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12451 | int i; |
| 12452 | /* check whether the digital-mic has to be supported */ |
| 12453 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12454 | if (spec->input_mux->items[i].index >= 9) |
| 12455 | break; |
| 12456 | } |
| 12457 | if (i < spec->input_mux->num_items) { |
| 12458 | /* use only ADC0 */ |
| 12459 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12460 | spec->num_adc_nids = 1; |
| 12461 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12462 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12463 | /* all analog inputs */ |
| 12464 | /* check whether NID 0x07 is valid */ |
| 12465 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12466 | |
| 12467 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12468 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12469 | if (wcap != AC_WID_AUD_IN) { |
| 12470 | spec->adc_nids = alc262_adc_nids_alt; |
| 12471 | spec->num_adc_nids = |
| 12472 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12473 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12474 | } else { |
| 12475 | spec->adc_nids = alc262_adc_nids; |
| 12476 | spec->num_adc_nids = |
| 12477 | ARRAY_SIZE(alc262_adc_nids); |
| 12478 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12479 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12480 | } |
| 12481 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12482 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12483 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12484 | if (!spec->no_analog && spec->cdefine.enable_pcbeep) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12485 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12486 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12487 | spec->vmaster_nid = 0x0c; |
| 12488 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12489 | codec->patch_ops = alc_patch_ops; |
| 12490 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12491 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12492 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12493 | if (!spec->loopback.amplist) |
| 12494 | spec->loopback.amplist = alc262_loopbacks; |
| 12495 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12496 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12497 | return 0; |
| 12498 | } |
| 12499 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12500 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12501 | * ALC268 channel source setting (2 channel) |
| 12502 | */ |
| 12503 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12504 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12505 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12506 | static hda_nid_t alc268_dac_nids[2] = { |
| 12507 | /* front, hp */ |
| 12508 | 0x02, 0x03 |
| 12509 | }; |
| 12510 | |
| 12511 | static hda_nid_t alc268_adc_nids[2] = { |
| 12512 | /* ADC0-1 */ |
| 12513 | 0x08, 0x07 |
| 12514 | }; |
| 12515 | |
| 12516 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 12517 | /* ADC0 */ |
| 12518 | 0x08 |
| 12519 | }; |
| 12520 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12521 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 12522 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12523 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 12524 | /* output mixer control */ |
| 12525 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12526 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12527 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12528 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12529 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12530 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12531 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12532 | { } |
| 12533 | }; |
| 12534 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12535 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 12536 | /* output mixer control */ |
| 12537 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12538 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12539 | ALC262_HIPPO_MASTER_SWITCH, |
| 12540 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12541 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12542 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12543 | { } |
| 12544 | }; |
| 12545 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12546 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 12547 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 12548 | .ops = &snd_hda_bind_sw, |
| 12549 | .values = { |
| 12550 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 12551 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 12552 | 0 |
| 12553 | }, |
| 12554 | }; |
| 12555 | |
| 12556 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 12557 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 12558 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 12559 | { } |
| 12560 | }; |
| 12561 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12562 | static struct hda_verb alc268_eapd_verbs[] = { |
| 12563 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12564 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12565 | { } |
| 12566 | }; |
| 12567 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12568 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12569 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 12570 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12571 | { } /* end */ |
| 12572 | }; |
| 12573 | |
| 12574 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12575 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 12576 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 12577 | .ops = &snd_hda_bind_vol, |
| 12578 | .values = { |
| 12579 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12580 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12581 | 0 |
| 12582 | }, |
| 12583 | }; |
| 12584 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12585 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12586 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 12587 | { |
| 12588 | struct alc_spec *spec = codec->spec; |
| 12589 | unsigned int mute; |
| 12590 | |
| 12591 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12592 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12593 | spec->sense_updated = 1; |
| 12594 | } |
| 12595 | if (spec->jack_present) |
| 12596 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 12597 | else /* unmute internal speaker if necessary */ |
| 12598 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 12599 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12600 | HDA_AMP_MUTE, mute); |
| 12601 | } |
| 12602 | |
| 12603 | |
| 12604 | /* bind hp and internal speaker mute (with plug check) */ |
| 12605 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 12606 | struct snd_ctl_elem_value *ucontrol) |
| 12607 | { |
| 12608 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12609 | long *valp = ucontrol->value.integer.value; |
| 12610 | int change; |
| 12611 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 12612 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12613 | if (change) |
| 12614 | alc268_acer_automute(codec, 0); |
| 12615 | return change; |
| 12616 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12617 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12618 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 12619 | /* output mixer control */ |
| 12620 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12621 | { |
| 12622 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12623 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12624 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12625 | .info = snd_hda_mixer_amp_switch_info, |
| 12626 | .get = snd_hda_mixer_amp_switch_get, |
| 12627 | .put = alc268_acer_master_sw_put, |
| 12628 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12629 | }, |
| 12630 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 12631 | { } |
| 12632 | }; |
| 12633 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12634 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 12635 | /* output mixer control */ |
| 12636 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12637 | { |
| 12638 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12639 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12640 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12641 | .info = snd_hda_mixer_amp_switch_info, |
| 12642 | .get = snd_hda_mixer_amp_switch_get, |
| 12643 | .put = alc268_acer_master_sw_put, |
| 12644 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12645 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12646 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12647 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12648 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12649 | { } |
| 12650 | }; |
| 12651 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12652 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 12653 | /* output mixer control */ |
| 12654 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12655 | { |
| 12656 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12657 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12658 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12659 | .info = snd_hda_mixer_amp_switch_info, |
| 12660 | .get = snd_hda_mixer_amp_switch_get, |
| 12661 | .put = alc268_acer_master_sw_put, |
| 12662 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12663 | }, |
| 12664 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12665 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12666 | { } |
| 12667 | }; |
| 12668 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12669 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 12670 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12671 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12672 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12673 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12674 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 12675 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 12676 | { } |
| 12677 | }; |
| 12678 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12679 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12680 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 12681 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12682 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12683 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12684 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12685 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12686 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12687 | { } |
| 12688 | }; |
| 12689 | |
| 12690 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12691 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12692 | #define alc268_toshiba_setup alc262_hippo_setup |
| 12693 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12694 | |
| 12695 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 12696 | unsigned int res) |
| 12697 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12698 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12699 | return; |
| 12700 | alc268_acer_automute(codec, 1); |
| 12701 | } |
| 12702 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12703 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 12704 | { |
| 12705 | alc268_acer_automute(codec, 1); |
| 12706 | } |
| 12707 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12708 | /* toggle speaker-output according to the hp-jack state */ |
| 12709 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 12710 | { |
| 12711 | unsigned int present; |
| 12712 | unsigned char bits; |
| 12713 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12714 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12715 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12716 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12717 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12718 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12719 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12720 | } |
| 12721 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12722 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 12723 | unsigned int res) |
| 12724 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12725 | switch (res >> 26) { |
| 12726 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12727 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12728 | break; |
| 12729 | case ALC880_MIC_EVENT: |
| 12730 | alc_mic_automute(codec); |
| 12731 | break; |
| 12732 | } |
| 12733 | } |
| 12734 | |
| 12735 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 12736 | { |
| 12737 | struct alc_spec *spec = codec->spec; |
| 12738 | spec->ext_mic.pin = 0x18; |
| 12739 | spec->ext_mic.mux_idx = 0; |
| 12740 | spec->int_mic.pin = 0x12; |
| 12741 | spec->int_mic.mux_idx = 6; |
| 12742 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12743 | } |
| 12744 | |
| 12745 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 12746 | { |
| 12747 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12748 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12749 | } |
| 12750 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12751 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 12752 | /* output mixer control */ |
| 12753 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12754 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12755 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12756 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12757 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12758 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12759 | { } |
| 12760 | }; |
| 12761 | |
| 12762 | static struct hda_verb alc268_dell_verbs[] = { |
| 12763 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12764 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12765 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12766 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12767 | { } |
| 12768 | }; |
| 12769 | |
| 12770 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12771 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12772 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12773 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12774 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12775 | spec->autocfg.hp_pins[0] = 0x15; |
| 12776 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12777 | spec->ext_mic.pin = 0x18; |
| 12778 | spec->ext_mic.mux_idx = 0; |
| 12779 | spec->int_mic.pin = 0x19; |
| 12780 | spec->int_mic.mux_idx = 1; |
| 12781 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12782 | } |
| 12783 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12784 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 12785 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12786 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12787 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12788 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12789 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12790 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12791 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12792 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12793 | { } |
| 12794 | }; |
| 12795 | |
| 12796 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 12797 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12798 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 12799 | { } |
| 12800 | }; |
| 12801 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12802 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12803 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12804 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12805 | spec->autocfg.hp_pins[0] = 0x15; |
| 12806 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12807 | spec->ext_mic.pin = 0x18; |
| 12808 | spec->ext_mic.mux_idx = 0; |
| 12809 | spec->int_mic.pin = 0x19; |
| 12810 | spec->int_mic.mux_idx = 1; |
| 12811 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12812 | } |
| 12813 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12814 | /* |
| 12815 | * generic initialization of ADC, input mixers and output mixers |
| 12816 | */ |
| 12817 | static struct hda_verb alc268_base_init_verbs[] = { |
| 12818 | /* Unmute DAC0-1 and set vol = 0 */ |
| 12819 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12820 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12821 | |
| 12822 | /* |
| 12823 | * Set up output mixers (0x0c - 0x0e) |
| 12824 | */ |
| 12825 | /* set vol=0 to output mixers */ |
| 12826 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12827 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12828 | |
| 12829 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12830 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12831 | |
| 12832 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12833 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12834 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12835 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12836 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12837 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12838 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12839 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12840 | |
| 12841 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12842 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12843 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12844 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12845 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12846 | |
| 12847 | /* set PCBEEP vol = 0, mute connections */ |
| 12848 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12849 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12850 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12851 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12852 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12853 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12854 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12855 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12856 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12857 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12858 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12859 | { } |
| 12860 | }; |
| 12861 | |
| 12862 | /* |
| 12863 | * generic initialization of ADC, input mixers and output mixers |
| 12864 | */ |
| 12865 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12866 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12867 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12868 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12869 | |
| 12870 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12871 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12872 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12873 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12874 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12875 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12876 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12877 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12878 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12879 | |
| 12880 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12881 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12882 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12883 | /* set PCBEEP vol = 0, mute connections */ |
| 12884 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12885 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12886 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12887 | |
| 12888 | { } |
| 12889 | }; |
| 12890 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12891 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 12892 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12893 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12894 | { } /* end */ |
| 12895 | }; |
| 12896 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12897 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 12898 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12899 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12900 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12901 | { } /* end */ |
| 12902 | }; |
| 12903 | |
| 12904 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 12905 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12906 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12907 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12908 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12909 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12910 | { } /* end */ |
| 12911 | }; |
| 12912 | |
| 12913 | static struct hda_input_mux alc268_capture_source = { |
| 12914 | .num_items = 4, |
| 12915 | .items = { |
| 12916 | { "Mic", 0x0 }, |
| 12917 | { "Front Mic", 0x1 }, |
| 12918 | { "Line", 0x2 }, |
| 12919 | { "CD", 0x3 }, |
| 12920 | }, |
| 12921 | }; |
| 12922 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12923 | static struct hda_input_mux alc268_acer_capture_source = { |
| 12924 | .num_items = 3, |
| 12925 | .items = { |
| 12926 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12927 | { "Internal Mic", 0x1 }, |
| 12928 | { "Line", 0x2 }, |
| 12929 | }, |
| 12930 | }; |
| 12931 | |
| 12932 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 12933 | .num_items = 3, |
| 12934 | .items = { |
| 12935 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12936 | { "Internal Mic", 0x6 }, |
| 12937 | { "Line", 0x2 }, |
| 12938 | }, |
| 12939 | }; |
| 12940 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12941 | #ifdef CONFIG_SND_DEBUG |
| 12942 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12943 | /* Volume widgets */ |
| 12944 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12945 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12946 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12947 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12948 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12949 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12950 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12951 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12952 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12953 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12954 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12955 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12956 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12957 | /* The below appears problematic on some hardwares */ |
| 12958 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12959 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12960 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12961 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12962 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12963 | |
| 12964 | /* Modes for retasking pin widgets */ |
| 12965 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12966 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12967 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12968 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12969 | |
| 12970 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12971 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12972 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12973 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12974 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12975 | |
| 12976 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12977 | * The ALC268 does not have an SPDIF input. |
| 12978 | */ |
| 12979 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12980 | |
| 12981 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12982 | * this output to turn on an external amplifier. |
| 12983 | */ |
| 12984 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12985 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12986 | |
| 12987 | { } /* end */ |
| 12988 | }; |
| 12989 | #endif |
| 12990 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12991 | /* create input playback/capture controls for the given pin */ |
| 12992 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12993 | const char *ctlname, int idx) |
| 12994 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12995 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12996 | int err; |
| 12997 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12998 | switch (nid) { |
| 12999 | case 0x14: |
| 13000 | case 0x16: |
| 13001 | dac = 0x02; |
| 13002 | break; |
| 13003 | case 0x15: |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13004 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13005 | dac = 0x03; |
| 13006 | break; |
| 13007 | default: |
| 13008 | return 0; |
| 13009 | } |
| 13010 | if (spec->multiout.dac_nids[0] != dac && |
| 13011 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13012 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13013 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13014 | HDA_OUTPUT)); |
| 13015 | if (err < 0) |
| 13016 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13017 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13018 | } |
| 13019 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13020 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13021 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13022 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13023 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13024 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13025 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13026 | if (err < 0) |
| 13027 | return err; |
| 13028 | return 0; |
| 13029 | } |
| 13030 | |
| 13031 | /* add playback controls from the parsed DAC table */ |
| 13032 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13033 | const struct auto_pin_cfg *cfg) |
| 13034 | { |
| 13035 | hda_nid_t nid; |
| 13036 | int err; |
| 13037 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13038 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13039 | |
| 13040 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13041 | if (nid) { |
| 13042 | const char *name; |
| 13043 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13044 | name = "Speaker"; |
| 13045 | else |
| 13046 | name = "Front"; |
| 13047 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13048 | if (err < 0) |
| 13049 | return err; |
| 13050 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13051 | |
| 13052 | nid = cfg->speaker_pins[0]; |
| 13053 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13054 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13055 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13056 | if (err < 0) |
| 13057 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13058 | } else { |
| 13059 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13060 | if (err < 0) |
| 13061 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13062 | } |
| 13063 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13064 | if (nid) { |
| 13065 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13066 | if (err < 0) |
| 13067 | return err; |
| 13068 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13069 | |
| 13070 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13071 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13072 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13073 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13074 | if (err < 0) |
| 13075 | return err; |
| 13076 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13077 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13078 | } |
| 13079 | |
| 13080 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13081 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13082 | const struct auto_pin_cfg *cfg) |
| 13083 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13084 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13085 | } |
| 13086 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13087 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13088 | hda_nid_t nid, int pin_type) |
| 13089 | { |
| 13090 | int idx; |
| 13091 | |
| 13092 | alc_set_pin_output(codec, nid, pin_type); |
| 13093 | if (nid == 0x14 || nid == 0x16) |
| 13094 | idx = 0; |
| 13095 | else |
| 13096 | idx = 1; |
| 13097 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13098 | } |
| 13099 | |
| 13100 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13101 | { |
| 13102 | struct alc_spec *spec = codec->spec; |
| 13103 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 13104 | if (nid) { |
| 13105 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13106 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13107 | } |
| 13108 | } |
| 13109 | |
| 13110 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13111 | { |
| 13112 | struct alc_spec *spec = codec->spec; |
| 13113 | hda_nid_t pin; |
| 13114 | |
| 13115 | pin = spec->autocfg.hp_pins[0]; |
| 13116 | if (pin) |
| 13117 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 13118 | pin = spec->autocfg.speaker_pins[0]; |
| 13119 | if (pin) |
| 13120 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 13121 | } |
| 13122 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13123 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13124 | { |
| 13125 | struct alc_spec *spec = codec->spec; |
| 13126 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13127 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13128 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13129 | unsigned int dac_vol1, dac_vol2; |
| 13130 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13131 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13132 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13133 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13134 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13135 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13136 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13137 | AMP_IN_UNMUTE(1)); |
| 13138 | snd_hda_codec_write(codec, 0x10, 0, |
| 13139 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13140 | AMP_IN_UNMUTE(1)); |
| 13141 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13142 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13143 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13144 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13145 | snd_hda_codec_write(codec, 0x10, 0, |
| 13146 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13147 | } |
| 13148 | |
| 13149 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13150 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13151 | dac_vol2 = AMP_OUT_ZERO; |
| 13152 | else if (line_nid == 0x15) |
| 13153 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13154 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13155 | dac_vol2 = AMP_OUT_ZERO; |
| 13156 | else if (hp_nid == 0x15) |
| 13157 | dac_vol1 = AMP_OUT_ZERO; |
| 13158 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13159 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13160 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13161 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13162 | |
| 13163 | snd_hda_codec_write(codec, 0x02, 0, |
| 13164 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13165 | snd_hda_codec_write(codec, 0x03, 0, |
| 13166 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13167 | } |
| 13168 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13169 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13170 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13171 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13172 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13173 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13174 | |
| 13175 | /* |
| 13176 | * BIOS auto configuration |
| 13177 | */ |
| 13178 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13179 | { |
| 13180 | struct alc_spec *spec = codec->spec; |
| 13181 | int err; |
| 13182 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13183 | |
| 13184 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13185 | alc268_ignore); |
| 13186 | if (err < 0) |
| 13187 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13188 | if (!spec->autocfg.line_outs) { |
| 13189 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13190 | spec->multiout.max_channels = 2; |
| 13191 | spec->no_analog = 1; |
| 13192 | goto dig_only; |
| 13193 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13194 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13195 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13196 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13197 | if (err < 0) |
| 13198 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13199 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13200 | if (err < 0) |
| 13201 | return err; |
| 13202 | |
| 13203 | spec->multiout.max_channels = 2; |
| 13204 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13205 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13206 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13207 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13208 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13209 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 13210 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13211 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13212 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13213 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13214 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13215 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13216 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13217 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13218 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13219 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13220 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13221 | err = alc_auto_add_mic_boost(codec); |
| 13222 | if (err < 0) |
| 13223 | return err; |
| 13224 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13225 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13226 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13227 | return 1; |
| 13228 | } |
| 13229 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13230 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13231 | |
| 13232 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13233 | static void alc268_auto_init(struct hda_codec *codec) |
| 13234 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13235 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13236 | alc268_auto_init_multi_out(codec); |
| 13237 | alc268_auto_init_hp_out(codec); |
| 13238 | alc268_auto_init_mono_speaker_out(codec); |
| 13239 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13240 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13241 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13242 | } |
| 13243 | |
| 13244 | /* |
| 13245 | * configuration and preset |
| 13246 | */ |
| 13247 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13248 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13249 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13250 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13251 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13252 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13253 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13254 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13255 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13256 | #ifdef CONFIG_SND_DEBUG |
| 13257 | [ALC268_TEST] = "test", |
| 13258 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13259 | [ALC268_AUTO] = "auto", |
| 13260 | }; |
| 13261 | |
| 13262 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13263 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13264 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13265 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13266 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13267 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13268 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13269 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13270 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13271 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13272 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13273 | /* almost compatible with toshiba but with optional digital outs; |
| 13274 | * auto-probing seems working fine |
| 13275 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13276 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13277 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13278 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13279 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13280 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13281 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13282 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13283 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13284 | {} |
| 13285 | }; |
| 13286 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13287 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13288 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13289 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13290 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13291 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13292 | ALC268_TOSHIBA), |
| 13293 | {} |
| 13294 | }; |
| 13295 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13296 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13297 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13298 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13299 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13300 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13301 | alc267_quanta_il1_verbs }, |
| 13302 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13303 | .dac_nids = alc268_dac_nids, |
| 13304 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13305 | .adc_nids = alc268_adc_nids_alt, |
| 13306 | .hp_nid = 0x03, |
| 13307 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13308 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13309 | .unsol_event = alc_sku_unsol_event, |
| 13310 | .setup = alc267_quanta_il1_setup, |
| 13311 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13312 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13313 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13314 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13315 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13316 | .init_verbs = { alc268_base_init_verbs }, |
| 13317 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13318 | .dac_nids = alc268_dac_nids, |
| 13319 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13320 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13321 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13322 | .hp_nid = 0x03, |
| 13323 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13324 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13325 | .channel_mode = alc268_modes, |
| 13326 | .input_mux = &alc268_capture_source, |
| 13327 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13328 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13329 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13330 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13331 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13332 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13333 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13334 | .dac_nids = alc268_dac_nids, |
| 13335 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13336 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13337 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13338 | .hp_nid = 0x03, |
| 13339 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13340 | .channel_mode = alc268_modes, |
| 13341 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13342 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13343 | .setup = alc268_toshiba_setup, |
| 13344 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13345 | }, |
| 13346 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13347 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13348 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13349 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13350 | alc268_acer_verbs }, |
| 13351 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13352 | .dac_nids = alc268_dac_nids, |
| 13353 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13354 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13355 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13356 | .hp_nid = 0x02, |
| 13357 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13358 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13359 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13360 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13361 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13362 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13363 | [ALC268_ACER_DMIC] = { |
| 13364 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13365 | alc268_beep_mixer }, |
| 13366 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13367 | alc268_acer_verbs }, |
| 13368 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13369 | .dac_nids = alc268_dac_nids, |
| 13370 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13371 | .adc_nids = alc268_adc_nids_alt, |
| 13372 | .capsrc_nids = alc268_capsrc_nids, |
| 13373 | .hp_nid = 0x02, |
| 13374 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13375 | .channel_mode = alc268_modes, |
| 13376 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13377 | .unsol_event = alc268_acer_unsol_event, |
| 13378 | .init_hook = alc268_acer_init_hook, |
| 13379 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13380 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13381 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13382 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13383 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13384 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13385 | alc268_acer_aspire_one_verbs }, |
| 13386 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13387 | .dac_nids = alc268_dac_nids, |
| 13388 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13389 | .adc_nids = alc268_adc_nids_alt, |
| 13390 | .capsrc_nids = alc268_capsrc_nids, |
| 13391 | .hp_nid = 0x03, |
| 13392 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13393 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13394 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13395 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13396 | .init_hook = alc268_acer_lc_init_hook, |
| 13397 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13398 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13399 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13400 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13401 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13402 | alc268_dell_verbs }, |
| 13403 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13404 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13405 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13406 | .adc_nids = alc268_adc_nids_alt, |
| 13407 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13408 | .hp_nid = 0x02, |
| 13409 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13410 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13411 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13412 | .setup = alc268_dell_setup, |
| 13413 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13414 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13415 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13416 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13417 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13418 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13419 | alc268_toshiba_verbs }, |
| 13420 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13421 | .dac_nids = alc268_dac_nids, |
| 13422 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13423 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13424 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13425 | .hp_nid = 0x03, |
| 13426 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13427 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13428 | .channel_mode = alc268_modes, |
| 13429 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13430 | .setup = alc268_toshiba_setup, |
| 13431 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13432 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13433 | #ifdef CONFIG_SND_DEBUG |
| 13434 | [ALC268_TEST] = { |
| 13435 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13436 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13437 | alc268_volume_init_verbs }, |
| 13438 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13439 | .dac_nids = alc268_dac_nids, |
| 13440 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13441 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13442 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13443 | .hp_nid = 0x03, |
| 13444 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13445 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13446 | .channel_mode = alc268_modes, |
| 13447 | .input_mux = &alc268_capture_source, |
| 13448 | }, |
| 13449 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13450 | }; |
| 13451 | |
| 13452 | static int patch_alc268(struct hda_codec *codec) |
| 13453 | { |
| 13454 | struct alc_spec *spec; |
| 13455 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13456 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13457 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13458 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13459 | if (spec == NULL) |
| 13460 | return -ENOMEM; |
| 13461 | |
| 13462 | codec->spec = spec; |
| 13463 | |
| 13464 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13465 | alc268_models, |
| 13466 | alc268_cfg_tbl); |
| 13467 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13468 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13469 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13470 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13471 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13472 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13473 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13474 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13475 | board_config = ALC268_AUTO; |
| 13476 | } |
| 13477 | |
| 13478 | if (board_config == ALC268_AUTO) { |
| 13479 | /* automatic parse from the BIOS config */ |
| 13480 | err = alc268_parse_auto_config(codec); |
| 13481 | if (err < 0) { |
| 13482 | alc_free(codec); |
| 13483 | return err; |
| 13484 | } else if (!err) { |
| 13485 | printk(KERN_INFO |
| 13486 | "hda_codec: Cannot set up configuration " |
| 13487 | "from BIOS. Using base mode...\n"); |
| 13488 | board_config = ALC268_3ST; |
| 13489 | } |
| 13490 | } |
| 13491 | |
| 13492 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13493 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13494 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13495 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 13496 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13497 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13498 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13499 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 13500 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13501 | has_beep = 0; |
| 13502 | for (i = 0; i < spec->num_mixers; i++) { |
| 13503 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 13504 | has_beep = 1; |
| 13505 | break; |
| 13506 | } |
| 13507 | } |
| 13508 | |
| 13509 | if (has_beep) { |
| 13510 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13511 | if (err < 0) { |
| 13512 | alc_free(codec); |
| 13513 | return err; |
| 13514 | } |
| 13515 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 13516 | /* override the amp caps for beep generator */ |
| 13517 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13518 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 13519 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 13520 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 13521 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13522 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13523 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13524 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13525 | /* check whether NID 0x07 is valid */ |
| 13526 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13527 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13528 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13529 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13530 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13531 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13532 | if (spec->auto_mic || |
| 13533 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13534 | spec->adc_nids = alc268_adc_nids_alt; |
| 13535 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13536 | if (spec->auto_mic) |
| 13537 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13538 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 13539 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 13540 | else |
| 13541 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13542 | } else { |
| 13543 | spec->adc_nids = alc268_adc_nids; |
| 13544 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13545 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13546 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13547 | /* set default input source */ |
| 13548 | for (i = 0; i < spec->num_adc_nids; i++) |
| 13549 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 13550 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13551 | i < spec->num_mux_defs ? |
| 13552 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13553 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13554 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13555 | |
| 13556 | spec->vmaster_nid = 0x02; |
| 13557 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13558 | codec->patch_ops = alc_patch_ops; |
| 13559 | if (board_config == ALC268_AUTO) |
| 13560 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13561 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13562 | return 0; |
| 13563 | } |
| 13564 | |
| 13565 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13566 | * ALC269 channel source setting (2 channel) |
| 13567 | */ |
| 13568 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 13569 | |
| 13570 | #define alc269_dac_nids alc260_dac_nids |
| 13571 | |
| 13572 | static hda_nid_t alc269_adc_nids[1] = { |
| 13573 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13574 | 0x08, |
| 13575 | }; |
| 13576 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13577 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 13578 | 0x23, |
| 13579 | }; |
| 13580 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13581 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 13582 | /* ADC1 */ |
| 13583 | 0x09, |
| 13584 | }; |
| 13585 | |
| 13586 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 13587 | 0x22, |
| 13588 | }; |
| 13589 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 13590 | static hda_nid_t alc269_adc_candidates[] = { |
| 13591 | 0x08, 0x09, 0x07, |
| 13592 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13593 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13594 | #define alc269_modes alc260_modes |
| 13595 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 13596 | |
| 13597 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 13598 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13599 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13600 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13601 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13602 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13603 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13604 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13605 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13606 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13607 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13608 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13609 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 13610 | { } /* end */ |
| 13611 | }; |
| 13612 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13613 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 13614 | /* output mixer control */ |
| 13615 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13616 | { |
| 13617 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13618 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13619 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13620 | .info = snd_hda_mixer_amp_switch_info, |
| 13621 | .get = snd_hda_mixer_amp_switch_get, |
| 13622 | .put = alc268_acer_master_sw_put, |
| 13623 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13624 | }, |
| 13625 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13626 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13627 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13628 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13629 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13630 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13631 | { } |
| 13632 | }; |
| 13633 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13634 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 13635 | /* output mixer control */ |
| 13636 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13637 | { |
| 13638 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13639 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13640 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13641 | .info = snd_hda_mixer_amp_switch_info, |
| 13642 | .get = snd_hda_mixer_amp_switch_get, |
| 13643 | .put = alc268_acer_master_sw_put, |
| 13644 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13645 | }, |
| 13646 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13647 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13648 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13649 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13650 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13651 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13652 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 13653 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 13654 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13655 | { } |
| 13656 | }; |
| 13657 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13658 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13659 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13660 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13661 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13662 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13663 | { } /* end */ |
| 13664 | }; |
| 13665 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13666 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 13667 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13668 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13669 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13670 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13671 | { } /* end */ |
| 13672 | }; |
| 13673 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13674 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13675 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 13676 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13677 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 13678 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13679 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13680 | { } /* end */ |
| 13681 | }; |
| 13682 | |
| 13683 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13684 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13685 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13686 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13687 | { } /* end */ |
| 13688 | }; |
| 13689 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13690 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 13691 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13692 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13693 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13694 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13695 | { } /* end */ |
| 13696 | }; |
| 13697 | |
| 13698 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 13699 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13700 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13701 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13702 | { } /* end */ |
| 13703 | }; |
| 13704 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13705 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13706 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13707 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13708 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 13709 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13710 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13711 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13712 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13713 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13714 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13715 | { } |
| 13716 | }; |
| 13717 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13718 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 13719 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13720 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13721 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13722 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13723 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13724 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13725 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13726 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13727 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13728 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13729 | { } |
| 13730 | }; |
| 13731 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13732 | /* toggle speaker-output according to the hp-jack state */ |
| 13733 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 13734 | { |
| 13735 | unsigned int present; |
| 13736 | unsigned char bits; |
| 13737 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13738 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13739 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13740 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13741 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13742 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13743 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13744 | |
| 13745 | snd_hda_codec_write(codec, 0x20, 0, |
| 13746 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13747 | snd_hda_codec_write(codec, 0x20, 0, |
| 13748 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13749 | |
| 13750 | snd_hda_codec_write(codec, 0x20, 0, |
| 13751 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13752 | snd_hda_codec_write(codec, 0x20, 0, |
| 13753 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13754 | } |
| 13755 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13756 | /* toggle speaker-output according to the hp-jacks state */ |
| 13757 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 13758 | { |
| 13759 | unsigned int present; |
| 13760 | unsigned char bits; |
| 13761 | |
| 13762 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13763 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13764 | |
| 13765 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13766 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13767 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13768 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13769 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13770 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13771 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13772 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13773 | |
| 13774 | snd_hda_codec_write(codec, 0x20, 0, |
| 13775 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13776 | snd_hda_codec_write(codec, 0x20, 0, |
| 13777 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13778 | |
| 13779 | snd_hda_codec_write(codec, 0x20, 0, |
| 13780 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13781 | snd_hda_codec_write(codec, 0x20, 0, |
| 13782 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13783 | } |
| 13784 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13785 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 13786 | { |
| 13787 | unsigned int present_laptop; |
| 13788 | unsigned int present_dock; |
| 13789 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13790 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 13791 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13792 | |
| 13793 | /* Laptop mic port overrides dock mic port, design decision */ |
| 13794 | if (present_dock) |
| 13795 | snd_hda_codec_write(codec, 0x23, 0, |
| 13796 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 13797 | if (present_laptop) |
| 13798 | snd_hda_codec_write(codec, 0x23, 0, |
| 13799 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 13800 | if (!present_dock && !present_laptop) |
| 13801 | snd_hda_codec_write(codec, 0x23, 0, |
| 13802 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 13803 | } |
| 13804 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13805 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 13806 | unsigned int res) |
| 13807 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13808 | switch (res >> 26) { |
| 13809 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13810 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13811 | break; |
| 13812 | case ALC880_MIC_EVENT: |
| 13813 | alc_mic_automute(codec); |
| 13814 | break; |
| 13815 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13816 | } |
| 13817 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13818 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 13819 | unsigned int res) |
| 13820 | { |
| 13821 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13822 | alc269_lifebook_speaker_automute(codec); |
| 13823 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13824 | alc269_lifebook_mic_autoswitch(codec); |
| 13825 | } |
| 13826 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13827 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 13828 | { |
| 13829 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 13830 | spec->autocfg.hp_pins[0] = 0x15; |
| 13831 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13832 | spec->ext_mic.pin = 0x18; |
| 13833 | spec->ext_mic.mux_idx = 0; |
| 13834 | spec->int_mic.pin = 0x19; |
| 13835 | spec->int_mic.mux_idx = 1; |
| 13836 | spec->auto_mic = 1; |
| 13837 | } |
| 13838 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13839 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 13840 | { |
| 13841 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13842 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13843 | } |
| 13844 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13845 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 13846 | { |
| 13847 | alc269_lifebook_speaker_automute(codec); |
| 13848 | alc269_lifebook_mic_autoswitch(codec); |
| 13849 | } |
| 13850 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13851 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13852 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13853 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 13854 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13855 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13856 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13857 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13858 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13859 | {} |
| 13860 | }; |
| 13861 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13862 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13863 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13864 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13865 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13866 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13867 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13868 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13869 | {} |
| 13870 | }; |
| 13871 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13872 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 13873 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13874 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13875 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13876 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13877 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13878 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13879 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13880 | {} |
| 13881 | }; |
| 13882 | |
| 13883 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 13884 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13885 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13886 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13887 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13888 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13889 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13890 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13891 | {} |
| 13892 | }; |
| 13893 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13894 | /* toggle speaker-output according to the hp-jack state */ |
| 13895 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 13896 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13897 | struct alc_spec *spec = codec->spec; |
| 13898 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13899 | unsigned int present; |
| 13900 | unsigned char bits; |
| 13901 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13902 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13903 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13904 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13905 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13906 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13907 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13908 | } |
| 13909 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13910 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13911 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13912 | unsigned int res) |
| 13913 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13914 | switch (res >> 26) { |
| 13915 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13916 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13917 | break; |
| 13918 | case ALC880_MIC_EVENT: |
| 13919 | alc_mic_automute(codec); |
| 13920 | break; |
| 13921 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13922 | } |
| 13923 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 13924 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 13925 | { |
| 13926 | struct alc_spec *spec = codec->spec; |
| 13927 | spec->autocfg.hp_pins[0] = 0x15; |
| 13928 | spec->autocfg.speaker_pins[0] = 0x14; |
| 13929 | spec->ext_mic.pin = 0x18; |
| 13930 | spec->ext_mic.mux_idx = 0; |
| 13931 | spec->int_mic.pin = 0x19; |
| 13932 | spec->int_mic.mux_idx = 1; |
| 13933 | spec->auto_mic = 1; |
| 13934 | } |
| 13935 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13936 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13937 | { |
| 13938 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 13939 | spec->autocfg.hp_pins[0] = 0x15; |
| 13940 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13941 | spec->ext_mic.pin = 0x18; |
| 13942 | spec->ext_mic.mux_idx = 0; |
| 13943 | spec->int_mic.pin = 0x12; |
| 13944 | spec->int_mic.mux_idx = 5; |
| 13945 | spec->auto_mic = 1; |
| 13946 | } |
| 13947 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 13948 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13949 | { |
| 13950 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 13951 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 13952 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13953 | spec->ext_mic.pin = 0x18; |
| 13954 | spec->ext_mic.mux_idx = 0; |
| 13955 | spec->int_mic.pin = 0x19; |
| 13956 | spec->int_mic.mux_idx = 1; |
| 13957 | spec->auto_mic = 1; |
| 13958 | } |
| 13959 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 13960 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 13961 | { |
| 13962 | struct alc_spec *spec = codec->spec; |
| 13963 | spec->autocfg.hp_pins[0] = 0x21; |
| 13964 | spec->autocfg.speaker_pins[0] = 0x14; |
| 13965 | spec->ext_mic.pin = 0x18; |
| 13966 | spec->ext_mic.mux_idx = 0; |
| 13967 | spec->int_mic.pin = 0x12; |
| 13968 | spec->int_mic.mux_idx = 6; |
| 13969 | spec->auto_mic = 1; |
| 13970 | } |
| 13971 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13972 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13973 | { |
| 13974 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13975 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13976 | } |
| 13977 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13978 | /* |
| 13979 | * generic initialization of ADC, input mixers and output mixers |
| 13980 | */ |
| 13981 | static struct hda_verb alc269_init_verbs[] = { |
| 13982 | /* |
| 13983 | * Unmute ADC0 and set the default input to mic-in |
| 13984 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13985 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13986 | |
| 13987 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13988 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13989 | */ |
| 13990 | /* set vol=0 to output mixers */ |
| 13991 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13992 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13993 | |
| 13994 | /* set up input amps for analog loopback */ |
| 13995 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13996 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13997 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13998 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13999 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14000 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14001 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14002 | |
| 14003 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14004 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14005 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14006 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14007 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14008 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14009 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14010 | |
| 14011 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14012 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14013 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14014 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14015 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14016 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14017 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14018 | |
| 14019 | /* set EAPD */ |
| 14020 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14021 | { } |
| 14022 | }; |
| 14023 | |
| 14024 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14025 | /* |
| 14026 | * Unmute ADC0 and set the default input to mic-in |
| 14027 | */ |
| 14028 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14029 | |
| 14030 | /* |
| 14031 | * Set up output mixers (0x02 - 0x03) |
| 14032 | */ |
| 14033 | /* set vol=0 to output mixers */ |
| 14034 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14035 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14036 | |
| 14037 | /* set up input amps for analog loopback */ |
| 14038 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14039 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14040 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14041 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14042 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14043 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14044 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14045 | |
| 14046 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14047 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14048 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14049 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14050 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14051 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14052 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14053 | |
| 14054 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14055 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14056 | |
| 14057 | /* FIXME: use Mux-type input source selection */ |
| 14058 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14059 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14060 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14061 | |
| 14062 | /* set EAPD */ |
| 14063 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14064 | { } |
| 14065 | }; |
| 14066 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14067 | #define alc269_auto_create_multi_out_ctls \ |
| 14068 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14069 | #define alc269_auto_create_input_ctls \ |
| 14070 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14071 | |
| 14072 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14073 | #define alc269_loopbacks alc880_loopbacks |
| 14074 | #endif |
| 14075 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14076 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14077 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14078 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14079 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14080 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14081 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14082 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14083 | .substreams = 1, |
| 14084 | .channels_min = 2, |
| 14085 | .channels_max = 8, |
| 14086 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14087 | /* NID is set in alc_build_pcms */ |
| 14088 | .ops = { |
| 14089 | .open = alc880_playback_pcm_open, |
| 14090 | .prepare = alc880_playback_pcm_prepare, |
| 14091 | .cleanup = alc880_playback_pcm_cleanup |
| 14092 | }, |
| 14093 | }; |
| 14094 | |
| 14095 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14096 | .substreams = 1, |
| 14097 | .channels_min = 2, |
| 14098 | .channels_max = 2, |
| 14099 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14100 | /* NID is set in alc_build_pcms */ |
| 14101 | }; |
| 14102 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14103 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14104 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14105 | { |
| 14106 | switch (codec->subsystem_id) { |
| 14107 | case 0x103c1586: |
| 14108 | return 1; |
| 14109 | } |
| 14110 | return 0; |
| 14111 | } |
| 14112 | |
| 14113 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14114 | { |
| 14115 | /* update mute-LED according to the speaker mute state */ |
| 14116 | if (nid == 0x01 || nid == 0x14) { |
| 14117 | int pinval; |
| 14118 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14119 | HDA_AMP_MUTE) |
| 14120 | pinval = 0x24; |
| 14121 | else |
| 14122 | pinval = 0x20; |
| 14123 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a5 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14124 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14125 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14126 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14127 | } |
| 14128 | return alc_check_power_status(codec, nid); |
| 14129 | } |
| 14130 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14131 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14132 | /* |
| 14133 | * BIOS auto configuration |
| 14134 | */ |
| 14135 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14136 | { |
| 14137 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14138 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14139 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14140 | |
| 14141 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14142 | alc269_ignore); |
| 14143 | if (err < 0) |
| 14144 | return err; |
| 14145 | |
| 14146 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14147 | if (err < 0) |
| 14148 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14149 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14150 | if (err < 0) |
| 14151 | return err; |
| 14152 | |
| 14153 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14154 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14155 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14156 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 14157 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14158 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14159 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14160 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14161 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { |
| 14162 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14163 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14164 | } else { |
| 14165 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14166 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14167 | } |
| 14168 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14169 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14170 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14171 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14172 | sizeof(alc269_adc_candidates)); |
| 14173 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14174 | /* set default input source */ |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14175 | snd_hda_codec_write_cache(codec, spec->capsrc_nids[0], |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14176 | 0, AC_VERB_SET_CONNECT_SEL, |
| 14177 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14178 | |
| 14179 | err = alc_auto_add_mic_boost(codec); |
| 14180 | if (err < 0) |
| 14181 | return err; |
| 14182 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14183 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14184 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14185 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14186 | return 1; |
| 14187 | } |
| 14188 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14189 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14190 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14191 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14192 | |
| 14193 | |
| 14194 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14195 | static void alc269_auto_init(struct hda_codec *codec) |
| 14196 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14197 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14198 | alc269_auto_init_multi_out(codec); |
| 14199 | alc269_auto_init_hp_out(codec); |
| 14200 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14201 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14202 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14203 | } |
| 14204 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14205 | enum { |
| 14206 | ALC269_FIXUP_SONY_VAIO, |
| 14207 | }; |
| 14208 | |
Tobias Klauser | fbc2566 | 2010-05-20 10:40:55 +0200 | [diff] [blame] | 14209 | static const struct hda_verb alc269_sony_vaio_fixup_verbs[] = { |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14210 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14211 | {} |
| 14212 | }; |
| 14213 | |
| 14214 | static const struct alc_fixup alc269_fixups[] = { |
| 14215 | [ALC269_FIXUP_SONY_VAIO] = { |
| 14216 | .verbs = alc269_sony_vaio_fixup_verbs |
| 14217 | }, |
| 14218 | }; |
| 14219 | |
| 14220 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
| 14221 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
| 14222 | {} |
| 14223 | }; |
| 14224 | |
| 14225 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14226 | /* |
| 14227 | * configuration and preset |
| 14228 | */ |
| 14229 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14230 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14231 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14232 | [ALC269_AMIC] = "laptop-amic", |
| 14233 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14234 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14235 | [ALC269_LIFEBOOK] = "lifebook", |
| 14236 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14237 | }; |
| 14238 | |
| 14239 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14240 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14241 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14242 | ALC269_AMIC), |
| 14243 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14244 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14245 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14246 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14247 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14248 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14249 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14250 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14251 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 14252 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 14253 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14254 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14255 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14256 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14257 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14258 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14259 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14260 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14261 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14262 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14263 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14264 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14265 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14266 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14267 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14268 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14269 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14270 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14271 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14272 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14273 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14274 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14275 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14276 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14277 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14278 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14279 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14280 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14281 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14282 | ALC269_DMIC), |
| 14283 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14284 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14285 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14286 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14287 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14288 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14289 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14290 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14291 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14292 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14293 | {} |
| 14294 | }; |
| 14295 | |
| 14296 | static struct alc_config_preset alc269_presets[] = { |
| 14297 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14298 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14299 | .init_verbs = { alc269_init_verbs }, |
| 14300 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14301 | .dac_nids = alc269_dac_nids, |
| 14302 | .hp_nid = 0x03, |
| 14303 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14304 | .channel_mode = alc269_modes, |
| 14305 | .input_mux = &alc269_capture_source, |
| 14306 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14307 | [ALC269_QUANTA_FL1] = { |
| 14308 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14309 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14310 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14311 | .dac_nids = alc269_dac_nids, |
| 14312 | .hp_nid = 0x03, |
| 14313 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14314 | .channel_mode = alc269_modes, |
| 14315 | .input_mux = &alc269_capture_source, |
| 14316 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14317 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14318 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14319 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14320 | [ALC269_AMIC] = { |
| 14321 | .mixers = { alc269_laptop_mixer }, |
| 14322 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14323 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14324 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14325 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14326 | .dac_nids = alc269_dac_nids, |
| 14327 | .hp_nid = 0x03, |
| 14328 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14329 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14330 | .unsol_event = alc269_laptop_unsol_event, |
| 14331 | .setup = alc269_laptop_amic_setup, |
| 14332 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14333 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14334 | [ALC269_DMIC] = { |
| 14335 | .mixers = { alc269_laptop_mixer }, |
| 14336 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14337 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14338 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14339 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14340 | .dac_nids = alc269_dac_nids, |
| 14341 | .hp_nid = 0x03, |
| 14342 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14343 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14344 | .unsol_event = alc269_laptop_unsol_event, |
| 14345 | .setup = alc269_laptop_dmic_setup, |
| 14346 | .init_hook = alc269_laptop_inithook, |
| 14347 | }, |
| 14348 | [ALC269VB_AMIC] = { |
| 14349 | .mixers = { alc269vb_laptop_mixer }, |
| 14350 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 14351 | .init_verbs = { alc269vb_init_verbs, |
| 14352 | alc269vb_laptop_amic_init_verbs }, |
| 14353 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14354 | .dac_nids = alc269_dac_nids, |
| 14355 | .hp_nid = 0x03, |
| 14356 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14357 | .channel_mode = alc269_modes, |
| 14358 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14359 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14360 | .init_hook = alc269_laptop_inithook, |
| 14361 | }, |
| 14362 | [ALC269VB_DMIC] = { |
| 14363 | .mixers = { alc269vb_laptop_mixer }, |
| 14364 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14365 | .init_verbs = { alc269vb_init_verbs, |
| 14366 | alc269vb_laptop_dmic_init_verbs }, |
| 14367 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14368 | .dac_nids = alc269_dac_nids, |
| 14369 | .hp_nid = 0x03, |
| 14370 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14371 | .channel_mode = alc269_modes, |
| 14372 | .unsol_event = alc269_laptop_unsol_event, |
| 14373 | .setup = alc269vb_laptop_dmic_setup, |
| 14374 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14375 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14376 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14377 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14378 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14379 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14380 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14381 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14382 | .dac_nids = alc269_dac_nids, |
| 14383 | .hp_nid = 0x03, |
| 14384 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14385 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14386 | .unsol_event = alc269_laptop_unsol_event, |
| 14387 | .setup = alc269_laptop_dmic_setup, |
| 14388 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14389 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14390 | [ALC269_LIFEBOOK] = { |
| 14391 | .mixers = { alc269_lifebook_mixer }, |
| 14392 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 14393 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14394 | .dac_nids = alc269_dac_nids, |
| 14395 | .hp_nid = 0x03, |
| 14396 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14397 | .channel_mode = alc269_modes, |
| 14398 | .input_mux = &alc269_capture_source, |
| 14399 | .unsol_event = alc269_lifebook_unsol_event, |
| 14400 | .init_hook = alc269_lifebook_init_hook, |
| 14401 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14402 | }; |
| 14403 | |
| 14404 | static int patch_alc269(struct hda_codec *codec) |
| 14405 | { |
| 14406 | struct alc_spec *spec; |
| 14407 | int board_config; |
| 14408 | int err; |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14409 | int is_alc269vb = 0; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14410 | |
| 14411 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14412 | if (spec == NULL) |
| 14413 | return -ENOMEM; |
| 14414 | |
| 14415 | codec->spec = spec; |
| 14416 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14417 | alc_auto_parse_customize_define(codec); |
| 14418 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14419 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14420 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 14421 | spec->cdefine.platform_type == 1) |
| 14422 | alc_codec_rename(codec, "ALC271X"); |
| 14423 | else |
| 14424 | alc_codec_rename(codec, "ALC259"); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14425 | is_alc269vb = 1; |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14426 | } else |
| 14427 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14428 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14429 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 14430 | alc269_models, |
| 14431 | alc269_cfg_tbl); |
| 14432 | |
| 14433 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14434 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14435 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14436 | board_config = ALC269_AUTO; |
| 14437 | } |
| 14438 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14439 | if (board_config == ALC269_AUTO) |
| 14440 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); |
| 14441 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14442 | if (board_config == ALC269_AUTO) { |
| 14443 | /* automatic parse from the BIOS config */ |
| 14444 | err = alc269_parse_auto_config(codec); |
| 14445 | if (err < 0) { |
| 14446 | alc_free(codec); |
| 14447 | return err; |
| 14448 | } else if (!err) { |
| 14449 | printk(KERN_INFO |
| 14450 | "hda_codec: Cannot set up configuration " |
| 14451 | "from BIOS. Using base mode...\n"); |
| 14452 | board_config = ALC269_BASIC; |
| 14453 | } |
| 14454 | } |
| 14455 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14456 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14457 | if (err < 0) { |
| 14458 | alc_free(codec); |
| 14459 | return err; |
| 14460 | } |
| 14461 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14462 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14463 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14464 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14465 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14466 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 14467 | * fix the sample rate of analog I/O to 44.1kHz |
| 14468 | */ |
| 14469 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 14470 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 14471 | } else { |
| 14472 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14473 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 14474 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14475 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 14476 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 14477 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14478 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
| 14479 | if (!is_alc269vb) { |
| 14480 | spec->adc_nids = alc269_adc_nids; |
| 14481 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 14482 | spec->capsrc_nids = alc269_capsrc_nids; |
| 14483 | } else { |
| 14484 | spec->adc_nids = alc269vb_adc_nids; |
| 14485 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 14486 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 14487 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14488 | } |
| 14489 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14490 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14491 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14492 | if (spec->cdefine.enable_pcbeep) |
| 14493 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14494 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14495 | if (board_config == ALC269_AUTO) |
| 14496 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); |
| 14497 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 14498 | spec->vmaster_nid = 0x02; |
| 14499 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14500 | codec->patch_ops = alc_patch_ops; |
| 14501 | if (board_config == ALC269_AUTO) |
| 14502 | spec->init_hook = alc269_auto_init; |
| 14503 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14504 | if (!spec->loopback.amplist) |
| 14505 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14506 | if (alc269_mic2_for_mute_led(codec)) |
| 14507 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14508 | #endif |
| 14509 | |
| 14510 | return 0; |
| 14511 | } |
| 14512 | |
| 14513 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14514 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 14515 | */ |
| 14516 | |
| 14517 | /* |
| 14518 | * set the path ways for 2 channel output |
| 14519 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 14520 | */ |
| 14521 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 14522 | /* set pin widget 1Ah (line in) for input */ |
| 14523 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14524 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14525 | * the vref |
| 14526 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14527 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14528 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14529 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14530 | #if 0 |
| 14531 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14532 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14533 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14534 | { } /* end */ |
| 14535 | }; |
| 14536 | /* |
| 14537 | * 6ch mode |
| 14538 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 14539 | */ |
| 14540 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 14541 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14542 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14543 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14544 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14545 | |
| 14546 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14547 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14548 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14549 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14550 | #if 0 |
| 14551 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14552 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14553 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14554 | { } /* end */ |
| 14555 | }; |
| 14556 | |
| 14557 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 14558 | { 2, alc861_threestack_ch2_init }, |
| 14559 | { 6, alc861_threestack_ch6_init }, |
| 14560 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14561 | /* Set mic1 as input and unmute the mixer */ |
| 14562 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 14563 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14564 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14565 | { } /* end */ |
| 14566 | }; |
| 14567 | /* Set mic1 as output and mute mixer */ |
| 14568 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 14569 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14570 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14571 | { } /* end */ |
| 14572 | }; |
| 14573 | |
| 14574 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 14575 | { 2, alc861_uniwill_m31_ch2_init }, |
| 14576 | { 4, alc861_uniwill_m31_ch4_init }, |
| 14577 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14578 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14579 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 14580 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 14581 | /* set pin widget 1Ah (line in) for input */ |
| 14582 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14583 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14584 | * the vref |
| 14585 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14586 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14587 | |
| 14588 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14589 | #if 0 |
| 14590 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14591 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14592 | #endif |
| 14593 | { } /* end */ |
| 14594 | }; |
| 14595 | /* Set mic1 nad line-in as output and mute mixer */ |
| 14596 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 14597 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14598 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14599 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14600 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14601 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14602 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14603 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14604 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14605 | |
| 14606 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14607 | #if 0 |
| 14608 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14609 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14610 | #endif |
| 14611 | { } /* end */ |
| 14612 | }; |
| 14613 | |
| 14614 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 14615 | { 2, alc861_asus_ch2_init }, |
| 14616 | { 6, alc861_asus_ch6_init }, |
| 14617 | }; |
| 14618 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14619 | /* patch-ALC861 */ |
| 14620 | |
| 14621 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 14622 | /* output mixer control */ |
| 14623 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14624 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14625 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14626 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14627 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14628 | |
| 14629 | /*Input mixer control */ |
| 14630 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14631 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14632 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14633 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14634 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14635 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14636 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14637 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14638 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14639 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14640 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14641 | { } /* end */ |
| 14642 | }; |
| 14643 | |
| 14644 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 14645 | /* output mixer control */ |
| 14646 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14647 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14648 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14649 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14650 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14651 | |
| 14652 | /* Input mixer control */ |
| 14653 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14654 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14655 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14656 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14657 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14658 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14659 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14660 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14661 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14662 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14663 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14664 | { |
| 14665 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14666 | .name = "Channel Mode", |
| 14667 | .info = alc_ch_mode_info, |
| 14668 | .get = alc_ch_mode_get, |
| 14669 | .put = alc_ch_mode_put, |
| 14670 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 14671 | }, |
| 14672 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14673 | }; |
| 14674 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14675 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14676 | /* output mixer control */ |
| 14677 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14678 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14679 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14680 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14681 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14682 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14683 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14684 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 14685 | /* output mixer control */ |
| 14686 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14687 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14688 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14689 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14690 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14691 | |
| 14692 | /* Input mixer control */ |
| 14693 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14694 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14695 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14696 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14697 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14698 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14699 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14700 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14701 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14702 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14703 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14704 | { |
| 14705 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14706 | .name = "Channel Mode", |
| 14707 | .info = alc_ch_mode_info, |
| 14708 | .get = alc_ch_mode_get, |
| 14709 | .put = alc_ch_mode_put, |
| 14710 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14711 | }, |
| 14712 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14713 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14714 | |
| 14715 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 14716 | /* output mixer control */ |
| 14717 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14718 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14719 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14720 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14721 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14722 | |
| 14723 | /* Input mixer control */ |
| 14724 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14725 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14726 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14727 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14728 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14729 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14730 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14731 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14732 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14733 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 14734 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14735 | { |
| 14736 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14737 | .name = "Channel Mode", |
| 14738 | .info = alc_ch_mode_info, |
| 14739 | .get = alc_ch_mode_get, |
| 14740 | .put = alc_ch_mode_put, |
| 14741 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 14742 | }, |
| 14743 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14744 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14745 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14746 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14747 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14748 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14749 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14750 | { } |
| 14751 | }; |
| 14752 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14753 | /* |
| 14754 | * generic initialization of ADC, input mixers and output mixers |
| 14755 | */ |
| 14756 | static struct hda_verb alc861_base_init_verbs[] = { |
| 14757 | /* |
| 14758 | * Unmute ADC0 and set the default input to mic-in |
| 14759 | */ |
| 14760 | /* port-A for surround (rear panel) */ |
| 14761 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14762 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14763 | /* port-B for mic-in (rear panel) with vref */ |
| 14764 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14765 | /* port-C for line-in (rear panel) */ |
| 14766 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14767 | /* port-D for Front */ |
| 14768 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14769 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14770 | /* port-E for HP out (front panel) */ |
| 14771 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14772 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14773 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14774 | /* port-F for mic-in (front panel) with vref */ |
| 14775 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14776 | /* port-G for CLFE (rear panel) */ |
| 14777 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14778 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14779 | /* port-H for side (rear panel) */ |
| 14780 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14781 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14782 | /* CD-in */ |
| 14783 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14784 | /* route front mic to ADC1*/ |
| 14785 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14786 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14787 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14788 | /* Unmute DAC0~3 & spdif out*/ |
| 14789 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14790 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14791 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14792 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14793 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14794 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14795 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14796 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14797 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14798 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14799 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14800 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14801 | /* Unmute Stereo Mixer 15 */ |
| 14802 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14803 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14804 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14805 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14806 | |
| 14807 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14808 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14809 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14810 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14811 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14812 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14813 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14814 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14815 | /* hp used DAC 3 (Front) */ |
| 14816 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14817 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14818 | |
| 14819 | { } |
| 14820 | }; |
| 14821 | |
| 14822 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 14823 | /* |
| 14824 | * Unmute ADC0 and set the default input to mic-in |
| 14825 | */ |
| 14826 | /* port-A for surround (rear panel) */ |
| 14827 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14828 | /* port-B for mic-in (rear panel) with vref */ |
| 14829 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14830 | /* port-C for line-in (rear panel) */ |
| 14831 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14832 | /* port-D for Front */ |
| 14833 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14834 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14835 | /* port-E for HP out (front panel) */ |
| 14836 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14837 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14838 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14839 | /* port-F for mic-in (front panel) with vref */ |
| 14840 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14841 | /* port-G for CLFE (rear panel) */ |
| 14842 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14843 | /* port-H for side (rear panel) */ |
| 14844 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14845 | /* CD-in */ |
| 14846 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14847 | /* route front mic to ADC1*/ |
| 14848 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14849 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14850 | /* Unmute DAC0~3 & spdif out*/ |
| 14851 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14852 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14853 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14854 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14855 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14856 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14857 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14858 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14859 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14860 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14861 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14862 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14863 | /* Unmute Stereo Mixer 15 */ |
| 14864 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14865 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14866 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14867 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14868 | |
| 14869 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14870 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14871 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14872 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14873 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14874 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14875 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14876 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14877 | /* hp used DAC 3 (Front) */ |
| 14878 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14879 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14880 | { } |
| 14881 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14882 | |
| 14883 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 14884 | /* |
| 14885 | * Unmute ADC0 and set the default input to mic-in |
| 14886 | */ |
| 14887 | /* port-A for surround (rear panel) */ |
| 14888 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14889 | /* port-B for mic-in (rear panel) with vref */ |
| 14890 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14891 | /* port-C for line-in (rear panel) */ |
| 14892 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14893 | /* port-D for Front */ |
| 14894 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14895 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14896 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14897 | /* this has to be set to VREF80 */ |
| 14898 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14899 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14900 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14901 | /* port-F for mic-in (front panel) with vref */ |
| 14902 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14903 | /* port-G for CLFE (rear panel) */ |
| 14904 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14905 | /* port-H for side (rear panel) */ |
| 14906 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14907 | /* CD-in */ |
| 14908 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14909 | /* route front mic to ADC1*/ |
| 14910 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14911 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14912 | /* Unmute DAC0~3 & spdif out*/ |
| 14913 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14914 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14915 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14916 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14917 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14918 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14919 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14920 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14921 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14922 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14923 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14924 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14925 | /* Unmute Stereo Mixer 15 */ |
| 14926 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14927 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14928 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14929 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14930 | |
| 14931 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14932 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14933 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14934 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14935 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14936 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14937 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14938 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14939 | /* hp used DAC 3 (Front) */ |
| 14940 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14941 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14942 | { } |
| 14943 | }; |
| 14944 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14945 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 14946 | /* |
| 14947 | * Unmute ADC0 and set the default input to mic-in |
| 14948 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14949 | /* port-A for surround (rear panel) |
| 14950 | * according to codec#0 this is the HP jack |
| 14951 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14952 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 14953 | /* route front PCM to HP */ |
| 14954 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14955 | /* port-B for mic-in (rear panel) with vref */ |
| 14956 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14957 | /* port-C for line-in (rear panel) */ |
| 14958 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14959 | /* port-D for Front */ |
| 14960 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14961 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14962 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14963 | /* this has to be set to VREF80 */ |
| 14964 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14965 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14966 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14967 | /* port-F for mic-in (front panel) with vref */ |
| 14968 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14969 | /* port-G for CLFE (rear panel) */ |
| 14970 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14971 | /* port-H for side (rear panel) */ |
| 14972 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14973 | /* CD-in */ |
| 14974 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14975 | /* route front mic to ADC1*/ |
| 14976 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14977 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14978 | /* Unmute DAC0~3 & spdif out*/ |
| 14979 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14980 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14981 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14982 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14983 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14984 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14985 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14986 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14987 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14988 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14989 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14990 | /* Unmute Stereo Mixer 15 */ |
| 14991 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14992 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14993 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14994 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14995 | |
| 14996 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14997 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14998 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14999 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15000 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15001 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15002 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15003 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15004 | /* hp used DAC 3 (Front) */ |
| 15005 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15006 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15007 | { } |
| 15008 | }; |
| 15009 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15010 | /* additional init verbs for ASUS laptops */ |
| 15011 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15012 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15013 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15014 | { } |
| 15015 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15016 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15017 | /* |
| 15018 | * generic initialization of ADC, input mixers and output mixers |
| 15019 | */ |
| 15020 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15021 | /* |
| 15022 | * Unmute ADC0 and set the default input to mic-in |
| 15023 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15024 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15025 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15026 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15027 | /* Unmute DAC0~3 & spdif out*/ |
| 15028 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15029 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15030 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15031 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15032 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15033 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15034 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15035 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15036 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15037 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15038 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15039 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15040 | /* Unmute Stereo Mixer 15 */ |
| 15041 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15042 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15043 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15044 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15045 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15046 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15047 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15048 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15049 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15050 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15051 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15052 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15053 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15054 | |
| 15055 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15056 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15057 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15058 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15059 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15060 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15061 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15062 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15063 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15064 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15065 | |
| 15066 | { } |
| 15067 | }; |
| 15068 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15069 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15070 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15071 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15072 | { } |
| 15073 | }; |
| 15074 | |
| 15075 | /* toggle speaker-output according to the hp-jack state */ |
| 15076 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15077 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15078 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15079 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15080 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15081 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15082 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15083 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15084 | } |
| 15085 | |
| 15086 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15087 | unsigned int res) |
| 15088 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15089 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15090 | alc861_toshiba_automute(codec); |
| 15091 | } |
| 15092 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15093 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15094 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15095 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15096 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15097 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15098 | |
| 15099 | |
| 15100 | #define ALC861_DIGOUT_NID 0x07 |
| 15101 | |
| 15102 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15103 | { 8, NULL } |
| 15104 | }; |
| 15105 | |
| 15106 | static hda_nid_t alc861_dac_nids[4] = { |
| 15107 | /* front, surround, clfe, side */ |
| 15108 | 0x03, 0x06, 0x05, 0x04 |
| 15109 | }; |
| 15110 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15111 | static hda_nid_t alc660_dac_nids[3] = { |
| 15112 | /* front, clfe, surround */ |
| 15113 | 0x03, 0x05, 0x06 |
| 15114 | }; |
| 15115 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15116 | static hda_nid_t alc861_adc_nids[1] = { |
| 15117 | /* ADC0-2 */ |
| 15118 | 0x08, |
| 15119 | }; |
| 15120 | |
| 15121 | static struct hda_input_mux alc861_capture_source = { |
| 15122 | .num_items = 5, |
| 15123 | .items = { |
| 15124 | { "Mic", 0x0 }, |
| 15125 | { "Front Mic", 0x3 }, |
| 15126 | { "Line", 0x1 }, |
| 15127 | { "CD", 0x4 }, |
| 15128 | { "Mixer", 0x5 }, |
| 15129 | }, |
| 15130 | }; |
| 15131 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15132 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15133 | { |
| 15134 | struct alc_spec *spec = codec->spec; |
| 15135 | hda_nid_t mix, srcs[5]; |
| 15136 | int i, j, num; |
| 15137 | |
| 15138 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15139 | return 0; |
| 15140 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15141 | if (num < 0) |
| 15142 | return 0; |
| 15143 | for (i = 0; i < num; i++) { |
| 15144 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15145 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15146 | if (type != AC_WID_AUD_OUT) |
| 15147 | continue; |
| 15148 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15149 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15150 | break; |
| 15151 | if (j >= spec->multiout.num_dacs) |
| 15152 | return srcs[i]; |
| 15153 | } |
| 15154 | return 0; |
| 15155 | } |
| 15156 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15157 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15158 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15159 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15160 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15161 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15162 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15163 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15164 | |
| 15165 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15166 | for (i = 0; i < cfg->line_outs; i++) { |
| 15167 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15168 | dac = alc861_look_for_dac(codec, nid); |
| 15169 | if (!dac) |
| 15170 | continue; |
| 15171 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15172 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15173 | return 0; |
| 15174 | } |
| 15175 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15176 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15177 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15178 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15179 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15180 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15181 | } |
| 15182 | |
| 15183 | /* add playback controls from the parsed DAC table */ |
| 15184 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15185 | const struct auto_pin_cfg *cfg) |
| 15186 | { |
| 15187 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15188 | static const char *chname[4] = { |
| 15189 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15190 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15191 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15192 | int i, err; |
| 15193 | |
| 15194 | if (cfg->line_outs == 1) { |
| 15195 | const char *pfx = NULL; |
| 15196 | if (!cfg->hp_outs) |
| 15197 | pfx = "Master"; |
| 15198 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15199 | pfx = "Speaker"; |
| 15200 | if (pfx) { |
| 15201 | nid = spec->multiout.dac_nids[0]; |
| 15202 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 15203 | } |
| 15204 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15205 | |
| 15206 | for (i = 0; i < cfg->line_outs; i++) { |
| 15207 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15208 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15209 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15210 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15211 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15212 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15213 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15214 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15215 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15216 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15217 | return err; |
| 15218 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15219 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15220 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15221 | return err; |
| 15222 | } |
| 15223 | } |
| 15224 | return 0; |
| 15225 | } |
| 15226 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15227 | 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] | 15228 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15229 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15230 | int err; |
| 15231 | hda_nid_t nid; |
| 15232 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15233 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15234 | return 0; |
| 15235 | |
| 15236 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15237 | nid = alc861_look_for_dac(codec, pin); |
| 15238 | if (nid) { |
| 15239 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15240 | if (err < 0) |
| 15241 | return err; |
| 15242 | spec->multiout.hp_nid = nid; |
| 15243 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15244 | } |
| 15245 | return 0; |
| 15246 | } |
| 15247 | |
| 15248 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15249 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15250 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15251 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15252 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15253 | } |
| 15254 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15255 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15256 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15257 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15258 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15259 | hda_nid_t mix, srcs[5]; |
| 15260 | int i, num; |
| 15261 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15262 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15263 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15264 | 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] | 15265 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15266 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 15267 | return; |
| 15268 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15269 | if (num < 0) |
| 15270 | return; |
| 15271 | for (i = 0; i < num; i++) { |
| 15272 | unsigned int mute; |
| 15273 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 15274 | mute = AMP_IN_UNMUTE(i); |
| 15275 | else |
| 15276 | mute = AMP_IN_MUTE(i); |
| 15277 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15278 | mute); |
| 15279 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15280 | } |
| 15281 | |
| 15282 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 15283 | { |
| 15284 | struct alc_spec *spec = codec->spec; |
| 15285 | int i; |
| 15286 | |
| 15287 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 15288 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15289 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15290 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15291 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15292 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15293 | } |
| 15294 | } |
| 15295 | |
| 15296 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 15297 | { |
| 15298 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15299 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15300 | if (spec->autocfg.hp_outs) |
| 15301 | alc861_auto_set_output_and_unmute(codec, |
| 15302 | spec->autocfg.hp_pins[0], |
| 15303 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15304 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15305 | if (spec->autocfg.speaker_outs) |
| 15306 | alc861_auto_set_output_and_unmute(codec, |
| 15307 | spec->autocfg.speaker_pins[0], |
| 15308 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15309 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15310 | } |
| 15311 | |
| 15312 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 15313 | { |
| 15314 | struct alc_spec *spec = codec->spec; |
| 15315 | int i; |
| 15316 | |
| 15317 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15318 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15319 | if (nid >= 0x0c && nid <= 0x11) |
| 15320 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15321 | } |
| 15322 | } |
| 15323 | |
| 15324 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15325 | /* return 1 if successful, 0 if the proper config is not found, |
| 15326 | * or a negative error code |
| 15327 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15328 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 15329 | { |
| 15330 | struct alc_spec *spec = codec->spec; |
| 15331 | int err; |
| 15332 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 15333 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15334 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15335 | alc861_ignore); |
| 15336 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15337 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15338 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15339 | return 0; /* can't find valid BIOS pin config */ |
| 15340 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15341 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15342 | if (err < 0) |
| 15343 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15344 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15345 | if (err < 0) |
| 15346 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15347 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15348 | if (err < 0) |
| 15349 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15350 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15351 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15352 | return err; |
| 15353 | |
| 15354 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15355 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15356 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15357 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 15358 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15359 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15360 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15361 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15362 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15363 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 15364 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15365 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15366 | |
| 15367 | spec->adc_nids = alc861_adc_nids; |
| 15368 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15369 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15370 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 15371 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15372 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15373 | return 1; |
| 15374 | } |
| 15375 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15376 | /* additional initialization for auto-configuration model */ |
| 15377 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15378 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15379 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15380 | alc861_auto_init_multi_out(codec); |
| 15381 | alc861_auto_init_hp_out(codec); |
| 15382 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15383 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15384 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15385 | } |
| 15386 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15387 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15388 | static struct hda_amp_list alc861_loopbacks[] = { |
| 15389 | { 0x15, HDA_INPUT, 0 }, |
| 15390 | { 0x15, HDA_INPUT, 1 }, |
| 15391 | { 0x15, HDA_INPUT, 2 }, |
| 15392 | { 0x15, HDA_INPUT, 3 }, |
| 15393 | { } /* end */ |
| 15394 | }; |
| 15395 | #endif |
| 15396 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15397 | |
| 15398 | /* |
| 15399 | * configuration and preset |
| 15400 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15401 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 15402 | [ALC861_3ST] = "3stack", |
| 15403 | [ALC660_3ST] = "3stack-660", |
| 15404 | [ALC861_3ST_DIG] = "3stack-dig", |
| 15405 | [ALC861_6ST_DIG] = "6stack-dig", |
| 15406 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 15407 | [ALC861_TOSHIBA] = "toshiba", |
| 15408 | [ALC861_ASUS] = "asus", |
| 15409 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 15410 | [ALC861_AUTO] = "auto", |
| 15411 | }; |
| 15412 | |
| 15413 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 15414 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15415 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15416 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15417 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15418 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 15419 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 15420 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 15421 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 15422 | * Any other models that need this preset? |
| 15423 | */ |
| 15424 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 15425 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 15426 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15427 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 15428 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 15429 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 15430 | /* FIXME: the below seems conflict */ |
| 15431 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 15432 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 15433 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15434 | {} |
| 15435 | }; |
| 15436 | |
| 15437 | static struct alc_config_preset alc861_presets[] = { |
| 15438 | [ALC861_3ST] = { |
| 15439 | .mixers = { alc861_3ST_mixer }, |
| 15440 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15441 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15442 | .dac_nids = alc861_dac_nids, |
| 15443 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15444 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15445 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15446 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15447 | .adc_nids = alc861_adc_nids, |
| 15448 | .input_mux = &alc861_capture_source, |
| 15449 | }, |
| 15450 | [ALC861_3ST_DIG] = { |
| 15451 | .mixers = { alc861_base_mixer }, |
| 15452 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15453 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15454 | .dac_nids = alc861_dac_nids, |
| 15455 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15456 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15457 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15458 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15459 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15460 | .adc_nids = alc861_adc_nids, |
| 15461 | .input_mux = &alc861_capture_source, |
| 15462 | }, |
| 15463 | [ALC861_6ST_DIG] = { |
| 15464 | .mixers = { alc861_base_mixer }, |
| 15465 | .init_verbs = { alc861_base_init_verbs }, |
| 15466 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15467 | .dac_nids = alc861_dac_nids, |
| 15468 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15469 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 15470 | .channel_mode = alc861_8ch_modes, |
| 15471 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15472 | .adc_nids = alc861_adc_nids, |
| 15473 | .input_mux = &alc861_capture_source, |
| 15474 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15475 | [ALC660_3ST] = { |
| 15476 | .mixers = { alc861_3ST_mixer }, |
| 15477 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15478 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 15479 | .dac_nids = alc660_dac_nids, |
| 15480 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15481 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15482 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15483 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15484 | .adc_nids = alc861_adc_nids, |
| 15485 | .input_mux = &alc861_capture_source, |
| 15486 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15487 | [ALC861_UNIWILL_M31] = { |
| 15488 | .mixers = { alc861_uniwill_m31_mixer }, |
| 15489 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 15490 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15491 | .dac_nids = alc861_dac_nids, |
| 15492 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15493 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15494 | .channel_mode = alc861_uniwill_m31_modes, |
| 15495 | .need_dac_fix = 1, |
| 15496 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15497 | .adc_nids = alc861_adc_nids, |
| 15498 | .input_mux = &alc861_capture_source, |
| 15499 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15500 | [ALC861_TOSHIBA] = { |
| 15501 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15502 | .init_verbs = { alc861_base_init_verbs, |
| 15503 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15504 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15505 | .dac_nids = alc861_dac_nids, |
| 15506 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15507 | .channel_mode = alc883_3ST_2ch_modes, |
| 15508 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15509 | .adc_nids = alc861_adc_nids, |
| 15510 | .input_mux = &alc861_capture_source, |
| 15511 | .unsol_event = alc861_toshiba_unsol_event, |
| 15512 | .init_hook = alc861_toshiba_automute, |
| 15513 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15514 | [ALC861_ASUS] = { |
| 15515 | .mixers = { alc861_asus_mixer }, |
| 15516 | .init_verbs = { alc861_asus_init_verbs }, |
| 15517 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15518 | .dac_nids = alc861_dac_nids, |
| 15519 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15520 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 15521 | .channel_mode = alc861_asus_modes, |
| 15522 | .need_dac_fix = 1, |
| 15523 | .hp_nid = 0x06, |
| 15524 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15525 | .adc_nids = alc861_adc_nids, |
| 15526 | .input_mux = &alc861_capture_source, |
| 15527 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15528 | [ALC861_ASUS_LAPTOP] = { |
| 15529 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 15530 | .init_verbs = { alc861_asus_init_verbs, |
| 15531 | alc861_asus_laptop_init_verbs }, |
| 15532 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15533 | .dac_nids = alc861_dac_nids, |
| 15534 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15535 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15536 | .channel_mode = alc883_3ST_2ch_modes, |
| 15537 | .need_dac_fix = 1, |
| 15538 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15539 | .adc_nids = alc861_adc_nids, |
| 15540 | .input_mux = &alc861_capture_source, |
| 15541 | }, |
| 15542 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15543 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15544 | /* Pin config fixes */ |
| 15545 | enum { |
| 15546 | PINFIX_FSC_AMILO_PI1505, |
| 15547 | }; |
| 15548 | |
| 15549 | static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = { |
| 15550 | { 0x0b, 0x0221101f }, /* HP */ |
| 15551 | { 0x0f, 0x90170310 }, /* speaker */ |
| 15552 | { } |
| 15553 | }; |
| 15554 | |
| 15555 | static const struct alc_fixup alc861_fixups[] = { |
| 15556 | [PINFIX_FSC_AMILO_PI1505] = { |
| 15557 | .pins = alc861_fsc_amilo_pi1505_pinfix |
| 15558 | }, |
| 15559 | }; |
| 15560 | |
| 15561 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 15562 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 15563 | {} |
| 15564 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15565 | |
| 15566 | static int patch_alc861(struct hda_codec *codec) |
| 15567 | { |
| 15568 | struct alc_spec *spec; |
| 15569 | int board_config; |
| 15570 | int err; |
| 15571 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 15572 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15573 | if (spec == NULL) |
| 15574 | return -ENOMEM; |
| 15575 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15576 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15577 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15578 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 15579 | alc861_models, |
| 15580 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15581 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15582 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15583 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15584 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15585 | board_config = ALC861_AUTO; |
| 15586 | } |
| 15587 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 15588 | if (board_config == ALC861_AUTO) |
| 15589 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15590 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15591 | if (board_config == ALC861_AUTO) { |
| 15592 | /* automatic parse from the BIOS config */ |
| 15593 | err = alc861_parse_auto_config(codec); |
| 15594 | if (err < 0) { |
| 15595 | alc_free(codec); |
| 15596 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15597 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15598 | printk(KERN_INFO |
| 15599 | "hda_codec: Cannot set up configuration " |
| 15600 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15601 | board_config = ALC861_3ST_DIG; |
| 15602 | } |
| 15603 | } |
| 15604 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15605 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15606 | if (err < 0) { |
| 15607 | alc_free(codec); |
| 15608 | return err; |
| 15609 | } |
| 15610 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15611 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15612 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15613 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15614 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 15615 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 15616 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15617 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 15618 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 15619 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 15620 | if (!spec->cap_mixer) |
| 15621 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15622 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 15623 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15624 | spec->vmaster_nid = 0x03; |
| 15625 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 15626 | if (board_config == ALC861_AUTO) |
| 15627 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); |
| 15628 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15629 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15630 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15631 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15632 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15633 | spec->power_hook = alc_power_eapd; |
| 15634 | #endif |
| 15635 | } |
| 15636 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15637 | if (!spec->loopback.amplist) |
| 15638 | spec->loopback.amplist = alc861_loopbacks; |
| 15639 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15640 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15641 | return 0; |
| 15642 | } |
| 15643 | |
| 15644 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15645 | * ALC861-VD support |
| 15646 | * |
| 15647 | * Based on ALC882 |
| 15648 | * |
| 15649 | * In addition, an independent DAC |
| 15650 | */ |
| 15651 | #define ALC861VD_DIGOUT_NID 0x06 |
| 15652 | |
| 15653 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 15654 | /* front, surr, clfe, side surr */ |
| 15655 | 0x02, 0x03, 0x04, 0x05 |
| 15656 | }; |
| 15657 | |
| 15658 | /* dac_nids for ALC660vd are in a different order - according to |
| 15659 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15660 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15661 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 15662 | * - and it is the same as in 861vd. |
| 15663 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 15664 | */ |
| 15665 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 15666 | /* front, rear, clfe, rear_surr */ |
| 15667 | 0x02, 0x04, 0x03 |
| 15668 | }; |
| 15669 | |
| 15670 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 15671 | /* ADC0 */ |
| 15672 | 0x09, |
| 15673 | }; |
| 15674 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15675 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 15676 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15677 | /* input MUX */ |
| 15678 | /* FIXME: should be a matrix-type input source selection */ |
| 15679 | static struct hda_input_mux alc861vd_capture_source = { |
| 15680 | .num_items = 4, |
| 15681 | .items = { |
| 15682 | { "Mic", 0x0 }, |
| 15683 | { "Front Mic", 0x1 }, |
| 15684 | { "Line", 0x2 }, |
| 15685 | { "CD", 0x4 }, |
| 15686 | }, |
| 15687 | }; |
| 15688 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15689 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15690 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15691 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15692 | { "Ext Mic", 0x0 }, |
| 15693 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15694 | }, |
| 15695 | }; |
| 15696 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15697 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 15698 | .num_items = 2, |
| 15699 | .items = { |
| 15700 | { "Front Mic", 0x0 }, |
| 15701 | { "ATAPI Mic", 0x1 }, |
| 15702 | }, |
| 15703 | }; |
| 15704 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15705 | /* |
| 15706 | * 2ch mode |
| 15707 | */ |
| 15708 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 15709 | { 2, NULL } |
| 15710 | }; |
| 15711 | |
| 15712 | /* |
| 15713 | * 6ch mode |
| 15714 | */ |
| 15715 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 15716 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15717 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15718 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15719 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15720 | { } /* end */ |
| 15721 | }; |
| 15722 | |
| 15723 | /* |
| 15724 | * 8ch mode |
| 15725 | */ |
| 15726 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 15727 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15728 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15729 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15730 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15731 | { } /* end */ |
| 15732 | }; |
| 15733 | |
| 15734 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 15735 | { 6, alc861vd_6stack_ch6_init }, |
| 15736 | { 8, alc861vd_6stack_ch8_init }, |
| 15737 | }; |
| 15738 | |
| 15739 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 15740 | { |
| 15741 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15742 | .name = "Channel Mode", |
| 15743 | .info = alc_ch_mode_info, |
| 15744 | .get = alc_ch_mode_get, |
| 15745 | .put = alc_ch_mode_put, |
| 15746 | }, |
| 15747 | { } /* end */ |
| 15748 | }; |
| 15749 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15750 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15751 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15752 | */ |
| 15753 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 15754 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15755 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15756 | |
| 15757 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15758 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 15759 | |
| 15760 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 15761 | HDA_OUTPUT), |
| 15762 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 15763 | HDA_OUTPUT), |
| 15764 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 15765 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 15766 | |
| 15767 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 15768 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 15769 | |
| 15770 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15771 | |
| 15772 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15773 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15774 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15775 | |
| 15776 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15777 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15778 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15779 | |
| 15780 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15781 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15782 | |
| 15783 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15784 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15785 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15786 | { } /* end */ |
| 15787 | }; |
| 15788 | |
| 15789 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 15790 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15791 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15792 | |
| 15793 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15794 | |
| 15795 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15796 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15797 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15798 | |
| 15799 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15800 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15801 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15802 | |
| 15803 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15804 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15805 | |
| 15806 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15807 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15808 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15809 | { } /* end */ |
| 15810 | }; |
| 15811 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15812 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 15813 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15814 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 15815 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15816 | |
| 15817 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15818 | |
| 15819 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15820 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15821 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15822 | |
| 15823 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15824 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15825 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15826 | |
| 15827 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15828 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15829 | |
| 15830 | { } /* end */ |
| 15831 | }; |
| 15832 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15833 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 15834 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15835 | */ |
| 15836 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15837 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15838 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15839 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15840 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15841 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 15842 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15843 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15844 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 15845 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15846 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15847 | { } /* end */ |
| 15848 | }; |
| 15849 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15850 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 15851 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 15852 | */ |
| 15853 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 15854 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15855 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15856 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15857 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 15858 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15859 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15860 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15861 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15862 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15863 | { } /* end */ |
| 15864 | }; |
| 15865 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15866 | /* |
| 15867 | * generic initialization of ADC, input mixers and output mixers |
| 15868 | */ |
| 15869 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 15870 | /* |
| 15871 | * Unmute ADC0 and set the default input to mic-in |
| 15872 | */ |
| 15873 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15874 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15875 | |
| 15876 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 15877 | * the analog-loopback mixer widget |
| 15878 | */ |
| 15879 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15880 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15881 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15882 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15883 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15884 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15885 | |
| 15886 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15887 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15888 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15889 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15890 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15891 | |
| 15892 | /* |
| 15893 | * Set up output mixers (0x02 - 0x05) |
| 15894 | */ |
| 15895 | /* set vol=0 to output mixers */ |
| 15896 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15897 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15898 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15899 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15900 | |
| 15901 | /* set up input amps for analog loopback */ |
| 15902 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 15903 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15904 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15905 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15906 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15907 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15908 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15909 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15910 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15911 | |
| 15912 | { } |
| 15913 | }; |
| 15914 | |
| 15915 | /* |
| 15916 | * 3-stack pin configuration: |
| 15917 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 15918 | */ |
| 15919 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 15920 | /* |
| 15921 | * Set pin mode and muting |
| 15922 | */ |
| 15923 | /* set front pin widgets 0x14 for output */ |
| 15924 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15925 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15926 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15927 | |
| 15928 | /* Mic (rear) pin: input vref at 80% */ |
| 15929 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15930 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15931 | /* Front Mic pin: input vref at 80% */ |
| 15932 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15933 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15934 | /* Line In pin: input */ |
| 15935 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15936 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15937 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15938 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15939 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15940 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15941 | /* CD pin widget for input */ |
| 15942 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15943 | |
| 15944 | { } |
| 15945 | }; |
| 15946 | |
| 15947 | /* |
| 15948 | * 6-stack pin configuration: |
| 15949 | */ |
| 15950 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 15951 | /* |
| 15952 | * Set pin mode and muting |
| 15953 | */ |
| 15954 | /* set front pin widgets 0x14 for output */ |
| 15955 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15956 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15957 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15958 | |
| 15959 | /* Rear Pin: output 1 (0x0d) */ |
| 15960 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15961 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15962 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 15963 | /* CLFE Pin: output 2 (0x0e) */ |
| 15964 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15965 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15966 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 15967 | /* Side Pin: output 3 (0x0f) */ |
| 15968 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15969 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15970 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 15971 | |
| 15972 | /* Mic (rear) pin: input vref at 80% */ |
| 15973 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15974 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15975 | /* Front Mic pin: input vref at 80% */ |
| 15976 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15977 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15978 | /* Line In pin: input */ |
| 15979 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15980 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15981 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15982 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15983 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15984 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15985 | /* CD pin widget for input */ |
| 15986 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15987 | |
| 15988 | { } |
| 15989 | }; |
| 15990 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15991 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 15992 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15993 | { } |
| 15994 | }; |
| 15995 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15996 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 15997 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15998 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15999 | { } |
| 16000 | }; |
| 16001 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16002 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16003 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16004 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16005 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16006 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16007 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16008 | {} |
| 16009 | }; |
| 16010 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16011 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 16012 | { |
| 16013 | unsigned int present; |
| 16014 | unsigned char bits; |
| 16015 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16016 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16017 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16018 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16019 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 16020 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16021 | } |
| 16022 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16023 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16024 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16025 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16026 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16027 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16028 | } |
| 16029 | |
| 16030 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16031 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16032 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16033 | alc861vd_lenovo_mic_automute(codec); |
| 16034 | } |
| 16035 | |
| 16036 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16037 | unsigned int res) |
| 16038 | { |
| 16039 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16040 | case ALC880_MIC_EVENT: |
| 16041 | alc861vd_lenovo_mic_automute(codec); |
| 16042 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16043 | default: |
| 16044 | alc_automute_amp_unsol_event(codec, res); |
| 16045 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16046 | } |
| 16047 | } |
| 16048 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16049 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16050 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16051 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16052 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16053 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16054 | |
| 16055 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16056 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16057 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16058 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16059 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16060 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16061 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16062 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16063 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16064 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16065 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16066 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16067 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16068 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16069 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16070 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16071 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16072 | |
| 16073 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16074 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16075 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16076 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16077 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16078 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16079 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16080 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16081 | |
| 16082 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16083 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16084 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16085 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16086 | |
| 16087 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16088 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16089 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16090 | |
| 16091 | { } /* end */ |
| 16092 | }; |
| 16093 | |
| 16094 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16095 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16096 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16097 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16098 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16099 | spec->autocfg.hp_pins[0] = 0x15; |
| 16100 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16101 | } |
| 16102 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16103 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16104 | #define alc861vd_loopbacks alc880_loopbacks |
| 16105 | #endif |
| 16106 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16107 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16108 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16109 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16110 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16111 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16112 | |
| 16113 | /* |
| 16114 | * configuration and preset |
| 16115 | */ |
| 16116 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 16117 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16118 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16119 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16120 | [ALC861VD_3ST] = "3stack", |
| 16121 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16122 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16123 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16124 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16125 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16126 | [ALC861VD_AUTO] = "auto", |
| 16127 | }; |
| 16128 | |
| 16129 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16130 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16131 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16132 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16133 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16134 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16135 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16136 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16137 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16138 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16139 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16140 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16141 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16142 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16143 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16144 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16145 | {} |
| 16146 | }; |
| 16147 | |
| 16148 | static struct alc_config_preset alc861vd_presets[] = { |
| 16149 | [ALC660VD_3ST] = { |
| 16150 | .mixers = { alc861vd_3st_mixer }, |
| 16151 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16152 | alc861vd_3stack_init_verbs }, |
| 16153 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16154 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16155 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16156 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16157 | .input_mux = &alc861vd_capture_source, |
| 16158 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16159 | [ALC660VD_3ST_DIG] = { |
| 16160 | .mixers = { alc861vd_3st_mixer }, |
| 16161 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16162 | alc861vd_3stack_init_verbs }, |
| 16163 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16164 | .dac_nids = alc660vd_dac_nids, |
| 16165 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16166 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16167 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16168 | .input_mux = &alc861vd_capture_source, |
| 16169 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16170 | [ALC861VD_3ST] = { |
| 16171 | .mixers = { alc861vd_3st_mixer }, |
| 16172 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16173 | alc861vd_3stack_init_verbs }, |
| 16174 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16175 | .dac_nids = alc861vd_dac_nids, |
| 16176 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16177 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16178 | .input_mux = &alc861vd_capture_source, |
| 16179 | }, |
| 16180 | [ALC861VD_3ST_DIG] = { |
| 16181 | .mixers = { alc861vd_3st_mixer }, |
| 16182 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16183 | alc861vd_3stack_init_verbs }, |
| 16184 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16185 | .dac_nids = alc861vd_dac_nids, |
| 16186 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16187 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16188 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16189 | .input_mux = &alc861vd_capture_source, |
| 16190 | }, |
| 16191 | [ALC861VD_6ST_DIG] = { |
| 16192 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16193 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16194 | alc861vd_6stack_init_verbs }, |
| 16195 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16196 | .dac_nids = alc861vd_dac_nids, |
| 16197 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16198 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16199 | .channel_mode = alc861vd_6stack_modes, |
| 16200 | .input_mux = &alc861vd_capture_source, |
| 16201 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16202 | [ALC861VD_LENOVO] = { |
| 16203 | .mixers = { alc861vd_lenovo_mixer }, |
| 16204 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16205 | alc861vd_3stack_init_verbs, |
| 16206 | alc861vd_eapd_verbs, |
| 16207 | alc861vd_lenovo_unsol_verbs }, |
| 16208 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16209 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16210 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16211 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16212 | .input_mux = &alc861vd_capture_source, |
| 16213 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16214 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16215 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16216 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16217 | [ALC861VD_DALLAS] = { |
| 16218 | .mixers = { alc861vd_dallas_mixer }, |
| 16219 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16220 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16221 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16222 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16223 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16224 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16225 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16226 | .setup = alc861vd_dallas_setup, |
| 16227 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16228 | }, |
| 16229 | [ALC861VD_HP] = { |
| 16230 | .mixers = { alc861vd_hp_mixer }, |
| 16231 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16232 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16233 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16234 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16235 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16236 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16237 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16238 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16239 | .setup = alc861vd_dallas_setup, |
| 16240 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16241 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16242 | [ALC660VD_ASUS_V1S] = { |
| 16243 | .mixers = { alc861vd_lenovo_mixer }, |
| 16244 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16245 | alc861vd_3stack_init_verbs, |
| 16246 | alc861vd_eapd_verbs, |
| 16247 | alc861vd_lenovo_unsol_verbs }, |
| 16248 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16249 | .dac_nids = alc660vd_dac_nids, |
| 16250 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16251 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16252 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16253 | .input_mux = &alc861vd_capture_source, |
| 16254 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16255 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16256 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16257 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16258 | }; |
| 16259 | |
| 16260 | /* |
| 16261 | * BIOS auto configuration |
| 16262 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16263 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 16264 | const struct auto_pin_cfg *cfg) |
| 16265 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16266 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16267 | } |
| 16268 | |
| 16269 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16270 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16271 | hda_nid_t nid, int pin_type, int dac_idx) |
| 16272 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16273 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16274 | } |
| 16275 | |
| 16276 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 16277 | { |
| 16278 | struct alc_spec *spec = codec->spec; |
| 16279 | int i; |
| 16280 | |
| 16281 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16282 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16283 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16284 | if (nid) |
| 16285 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16286 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16287 | } |
| 16288 | } |
| 16289 | |
| 16290 | |
| 16291 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 16292 | { |
| 16293 | struct alc_spec *spec = codec->spec; |
| 16294 | hda_nid_t pin; |
| 16295 | |
| 16296 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16297 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16298 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16299 | pin = spec->autocfg.speaker_pins[0]; |
| 16300 | if (pin) |
| 16301 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16302 | } |
| 16303 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16304 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 16305 | |
| 16306 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 16307 | { |
| 16308 | struct alc_spec *spec = codec->spec; |
| 16309 | int i; |
| 16310 | |
| 16311 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16312 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16313 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16314 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 16315 | if (nid != ALC861VD_PIN_CD_NID && |
| 16316 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16317 | snd_hda_codec_write(codec, nid, 0, |
| 16318 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16319 | AMP_OUT_MUTE); |
| 16320 | } |
| 16321 | } |
| 16322 | } |
| 16323 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16324 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 16325 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16326 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 16327 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 16328 | |
| 16329 | /* add playback controls from the parsed DAC table */ |
| 16330 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16331 | * different NIDs for mute/unmute switch and volume control */ |
| 16332 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16333 | const struct auto_pin_cfg *cfg) |
| 16334 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16335 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 16336 | hda_nid_t nid_v, nid_s; |
| 16337 | int i, err; |
| 16338 | |
| 16339 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16340 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16341 | continue; |
| 16342 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16343 | alc880_dac_to_idx( |
| 16344 | spec->multiout.dac_nids[i])); |
| 16345 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16346 | alc880_dac_to_idx( |
| 16347 | spec->multiout.dac_nids[i])); |
| 16348 | |
| 16349 | if (i == 2) { |
| 16350 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16351 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16352 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16353 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 16354 | HDA_OUTPUT)); |
| 16355 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16356 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16357 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16358 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16359 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 16360 | HDA_OUTPUT)); |
| 16361 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16362 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16363 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16364 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16365 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 16366 | HDA_INPUT)); |
| 16367 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16368 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16369 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16370 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16371 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 16372 | HDA_INPUT)); |
| 16373 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16374 | return err; |
| 16375 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16376 | const char *pfx; |
| 16377 | if (cfg->line_outs == 1 && |
| 16378 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 16379 | if (!cfg->hp_pins) |
| 16380 | pfx = "Speaker"; |
| 16381 | else |
| 16382 | pfx = "PCM"; |
| 16383 | } else |
| 16384 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16385 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16386 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 16387 | HDA_OUTPUT)); |
| 16388 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16389 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16390 | if (cfg->line_outs == 1 && |
| 16391 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 16392 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16393 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16394 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16395 | HDA_INPUT)); |
| 16396 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16397 | return err; |
| 16398 | } |
| 16399 | } |
| 16400 | return 0; |
| 16401 | } |
| 16402 | |
| 16403 | /* add playback controls for speaker and HP outputs */ |
| 16404 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16405 | * different NIDs for mute/unmute switch and volume control */ |
| 16406 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 16407 | hda_nid_t pin, const char *pfx) |
| 16408 | { |
| 16409 | hda_nid_t nid_v, nid_s; |
| 16410 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16411 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16412 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16413 | return 0; |
| 16414 | |
| 16415 | if (alc880_is_fixed_pin(pin)) { |
| 16416 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16417 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16418 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16419 | spec->multiout.hp_nid = nid_v; |
| 16420 | else |
| 16421 | spec->multiout.extra_out_nid[0] = nid_v; |
| 16422 | /* control HP volume/switch on the output mixer amp */ |
| 16423 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16424 | alc880_fixed_pin_idx(pin)); |
| 16425 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16426 | alc880_fixed_pin_idx(pin)); |
| 16427 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16428 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16429 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 16430 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16431 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16432 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16433 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 16434 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16435 | return err; |
| 16436 | } else if (alc880_is_multi_pin(pin)) { |
| 16437 | /* set manual connection */ |
| 16438 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16439 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16440 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16441 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16442 | return err; |
| 16443 | } |
| 16444 | return 0; |
| 16445 | } |
| 16446 | |
| 16447 | /* parse the BIOS configuration and set up the alc_spec |
| 16448 | * return 1 if successful, 0 if the proper config is not found, |
| 16449 | * or a negative error code |
| 16450 | * Based on ALC880 version - had to change it to override |
| 16451 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 16452 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 16453 | { |
| 16454 | struct alc_spec *spec = codec->spec; |
| 16455 | int err; |
| 16456 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 16457 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16458 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16459 | alc861vd_ignore); |
| 16460 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16461 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16462 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16463 | return 0; /* can't find valid BIOS pin config */ |
| 16464 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16465 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16466 | if (err < 0) |
| 16467 | return err; |
| 16468 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16469 | if (err < 0) |
| 16470 | return err; |
| 16471 | err = alc861vd_auto_create_extra_out(spec, |
| 16472 | spec->autocfg.speaker_pins[0], |
| 16473 | "Speaker"); |
| 16474 | if (err < 0) |
| 16475 | return err; |
| 16476 | err = alc861vd_auto_create_extra_out(spec, |
| 16477 | spec->autocfg.hp_pins[0], |
| 16478 | "Headphone"); |
| 16479 | if (err < 0) |
| 16480 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16481 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16482 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16483 | return err; |
| 16484 | |
| 16485 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16486 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 16487 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16488 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 16489 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16490 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16491 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16492 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16493 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16494 | |
| 16495 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16496 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16497 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 16498 | err = alc_auto_add_mic_boost(codec); |
| 16499 | if (err < 0) |
| 16500 | return err; |
| 16501 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16502 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16503 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16504 | return 1; |
| 16505 | } |
| 16506 | |
| 16507 | /* additional initialization for auto-configuration model */ |
| 16508 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 16509 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16510 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16511 | alc861vd_auto_init_multi_out(codec); |
| 16512 | alc861vd_auto_init_hp_out(codec); |
| 16513 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16514 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16515 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16516 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16517 | } |
| 16518 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16519 | enum { |
| 16520 | ALC660VD_FIX_ASUS_GPIO1 |
| 16521 | }; |
| 16522 | |
| 16523 | /* reset GPIO1 */ |
| 16524 | static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = { |
| 16525 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 16526 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 16527 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 16528 | { } |
| 16529 | }; |
| 16530 | |
| 16531 | static const struct alc_fixup alc861vd_fixups[] = { |
| 16532 | [ALC660VD_FIX_ASUS_GPIO1] = { |
| 16533 | .verbs = alc660vd_fix_asus_gpio1_verbs, |
| 16534 | }, |
| 16535 | }; |
| 16536 | |
| 16537 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 16538 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 16539 | {} |
| 16540 | }; |
| 16541 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16542 | static int patch_alc861vd(struct hda_codec *codec) |
| 16543 | { |
| 16544 | struct alc_spec *spec; |
| 16545 | int err, board_config; |
| 16546 | |
| 16547 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16548 | if (spec == NULL) |
| 16549 | return -ENOMEM; |
| 16550 | |
| 16551 | codec->spec = spec; |
| 16552 | |
| 16553 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 16554 | alc861vd_models, |
| 16555 | alc861vd_cfg_tbl); |
| 16556 | |
| 16557 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16558 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16559 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16560 | board_config = ALC861VD_AUTO; |
| 16561 | } |
| 16562 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16563 | if (board_config == ALC861VD_AUTO) |
| 16564 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16565 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16566 | if (board_config == ALC861VD_AUTO) { |
| 16567 | /* automatic parse from the BIOS config */ |
| 16568 | err = alc861vd_parse_auto_config(codec); |
| 16569 | if (err < 0) { |
| 16570 | alc_free(codec); |
| 16571 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16572 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16573 | printk(KERN_INFO |
| 16574 | "hda_codec: Cannot set up configuration " |
| 16575 | "from BIOS. Using base mode...\n"); |
| 16576 | board_config = ALC861VD_3ST; |
| 16577 | } |
| 16578 | } |
| 16579 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16580 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16581 | if (err < 0) { |
| 16582 | alc_free(codec); |
| 16583 | return err; |
| 16584 | } |
| 16585 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16586 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16587 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16588 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16589 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16590 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16591 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16592 | } |
| 16593 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16594 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 16595 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 16596 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16597 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 16598 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 16599 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 16600 | if (!spec->adc_nids) { |
| 16601 | spec->adc_nids = alc861vd_adc_nids; |
| 16602 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 16603 | } |
| 16604 | if (!spec->capsrc_nids) |
| 16605 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16606 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16607 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16608 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16609 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16610 | spec->vmaster_nid = 0x02; |
| 16611 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16612 | if (board_config == ALC861VD_AUTO) |
| 16613 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); |
| 16614 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16615 | codec->patch_ops = alc_patch_ops; |
| 16616 | |
| 16617 | if (board_config == ALC861VD_AUTO) |
| 16618 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16619 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16620 | if (!spec->loopback.amplist) |
| 16621 | spec->loopback.amplist = alc861vd_loopbacks; |
| 16622 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16623 | |
| 16624 | return 0; |
| 16625 | } |
| 16626 | |
| 16627 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16628 | * ALC662 support |
| 16629 | * |
| 16630 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 16631 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 16632 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 16633 | * 6-channel independent captures. |
| 16634 | * |
| 16635 | * In addition, an independent DAC for the multi-playback (not used in this |
| 16636 | * driver yet). |
| 16637 | */ |
| 16638 | #define ALC662_DIGOUT_NID 0x06 |
| 16639 | #define ALC662_DIGIN_NID 0x0a |
| 16640 | |
| 16641 | static hda_nid_t alc662_dac_nids[4] = { |
| 16642 | /* front, rear, clfe, rear_surr */ |
| 16643 | 0x02, 0x03, 0x04 |
| 16644 | }; |
| 16645 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16646 | static hda_nid_t alc272_dac_nids[2] = { |
| 16647 | 0x02, 0x03 |
| 16648 | }; |
| 16649 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16650 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16651 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16652 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16653 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16654 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16655 | static hda_nid_t alc272_adc_nids[1] = { |
| 16656 | /* ADC1-2 */ |
| 16657 | 0x08, |
| 16658 | }; |
| 16659 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16660 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16661 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 16662 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16663 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16664 | /* input MUX */ |
| 16665 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16666 | static struct hda_input_mux alc662_capture_source = { |
| 16667 | .num_items = 4, |
| 16668 | .items = { |
| 16669 | { "Mic", 0x0 }, |
| 16670 | { "Front Mic", 0x1 }, |
| 16671 | { "Line", 0x2 }, |
| 16672 | { "CD", 0x4 }, |
| 16673 | }, |
| 16674 | }; |
| 16675 | |
| 16676 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 16677 | .num_items = 2, |
| 16678 | .items = { |
| 16679 | { "Mic", 0x1 }, |
| 16680 | { "Line", 0x2 }, |
| 16681 | }, |
| 16682 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16683 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16684 | static struct hda_input_mux alc663_capture_source = { |
| 16685 | .num_items = 3, |
| 16686 | .items = { |
| 16687 | { "Mic", 0x0 }, |
| 16688 | { "Front Mic", 0x1 }, |
| 16689 | { "Line", 0x2 }, |
| 16690 | }, |
| 16691 | }; |
| 16692 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16693 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16694 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 16695 | .num_items = 16, |
| 16696 | .items = { |
| 16697 | { "Autoselect Mic", 0x0 }, |
| 16698 | { "Internal Mic", 0x1 }, |
| 16699 | { "In-0x02", 0x2 }, |
| 16700 | { "In-0x03", 0x3 }, |
| 16701 | { "In-0x04", 0x4 }, |
| 16702 | { "In-0x05", 0x5 }, |
| 16703 | { "In-0x06", 0x6 }, |
| 16704 | { "In-0x07", 0x7 }, |
| 16705 | { "In-0x08", 0x8 }, |
| 16706 | { "In-0x09", 0x9 }, |
| 16707 | { "In-0x0a", 0x0a }, |
| 16708 | { "In-0x0b", 0x0b }, |
| 16709 | { "In-0x0c", 0x0c }, |
| 16710 | { "In-0x0d", 0x0d }, |
| 16711 | { "In-0x0e", 0x0e }, |
| 16712 | { "In-0x0f", 0x0f }, |
| 16713 | }, |
| 16714 | }; |
| 16715 | #endif |
| 16716 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16717 | /* |
| 16718 | * 2ch mode |
| 16719 | */ |
| 16720 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 16721 | { 2, NULL } |
| 16722 | }; |
| 16723 | |
| 16724 | /* |
| 16725 | * 2ch mode |
| 16726 | */ |
| 16727 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 16728 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 16729 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 16730 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 16731 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 16732 | { } /* end */ |
| 16733 | }; |
| 16734 | |
| 16735 | /* |
| 16736 | * 6ch mode |
| 16737 | */ |
| 16738 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 16739 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16740 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 16741 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 16742 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16743 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 16744 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 16745 | { } /* end */ |
| 16746 | }; |
| 16747 | |
| 16748 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 16749 | { 2, alc662_3ST_ch2_init }, |
| 16750 | { 6, alc662_3ST_ch6_init }, |
| 16751 | }; |
| 16752 | |
| 16753 | /* |
| 16754 | * 2ch mode |
| 16755 | */ |
| 16756 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 16757 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16758 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16759 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16760 | { } /* end */ |
| 16761 | }; |
| 16762 | |
| 16763 | /* |
| 16764 | * 6ch mode |
| 16765 | */ |
| 16766 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 16767 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16768 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16769 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16770 | { } /* end */ |
| 16771 | }; |
| 16772 | |
| 16773 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 16774 | { 2, alc662_sixstack_ch6_init }, |
| 16775 | { 6, alc662_sixstack_ch8_init }, |
| 16776 | }; |
| 16777 | |
| 16778 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16779 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16780 | */ |
| 16781 | |
| 16782 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 16783 | /* output mixer control */ |
| 16784 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16785 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16786 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16787 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16788 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16789 | 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] | 16790 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16791 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16792 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16793 | |
| 16794 | /*Input mixer control */ |
| 16795 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 16796 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 16797 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 16798 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 16799 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 16800 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 16801 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 16802 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16803 | { } /* end */ |
| 16804 | }; |
| 16805 | |
| 16806 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 16807 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16808 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16809 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16810 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16811 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16812 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16813 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16814 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16815 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16816 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16817 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16818 | { } /* end */ |
| 16819 | }; |
| 16820 | |
| 16821 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 16822 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16823 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16824 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16825 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16826 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16827 | 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] | 16828 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16829 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16830 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16831 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16832 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16833 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16834 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16835 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16836 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16837 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16838 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16839 | { } /* end */ |
| 16840 | }; |
| 16841 | |
| 16842 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 16843 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16844 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 16845 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16846 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16847 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16848 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16849 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16850 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16851 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16852 | { } /* end */ |
| 16853 | }; |
| 16854 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16855 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16856 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16857 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16858 | |
| 16859 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 16860 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16861 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16862 | |
| 16863 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16864 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16865 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16866 | { } /* end */ |
| 16867 | }; |
| 16868 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16869 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16870 | ALC262_HIPPO_MASTER_SWITCH, |
| 16871 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16872 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16873 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16874 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16875 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16876 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16877 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16878 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16879 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16880 | { } /* end */ |
| 16881 | }; |
| 16882 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16883 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 16884 | .ops = &snd_hda_bind_vol, |
| 16885 | .values = { |
| 16886 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 16887 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 16888 | 0 |
| 16889 | }, |
| 16890 | }; |
| 16891 | |
| 16892 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 16893 | .ops = &snd_hda_bind_sw, |
| 16894 | .values = { |
| 16895 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16896 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16897 | 0 |
| 16898 | }, |
| 16899 | }; |
| 16900 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16901 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16902 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16903 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 16904 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16905 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16906 | { } /* end */ |
| 16907 | }; |
| 16908 | |
| 16909 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 16910 | .ops = &snd_hda_bind_sw, |
| 16911 | .values = { |
| 16912 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16913 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16914 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16915 | 0 |
| 16916 | }, |
| 16917 | }; |
| 16918 | |
| 16919 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 16920 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16921 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 16922 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16923 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16924 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16925 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16926 | |
| 16927 | { } /* end */ |
| 16928 | }; |
| 16929 | |
| 16930 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 16931 | .ops = &snd_hda_bind_sw, |
| 16932 | .values = { |
| 16933 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16934 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16935 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16936 | 0 |
| 16937 | }, |
| 16938 | }; |
| 16939 | |
| 16940 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 16941 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16942 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 16943 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16944 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16945 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16946 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16947 | { } /* end */ |
| 16948 | }; |
| 16949 | |
| 16950 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16951 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16952 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16953 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16954 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16955 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16956 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16957 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16958 | { } /* end */ |
| 16959 | }; |
| 16960 | |
| 16961 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 16962 | .ops = &snd_hda_bind_vol, |
| 16963 | .values = { |
| 16964 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 16965 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 16966 | 0 |
| 16967 | }, |
| 16968 | }; |
| 16969 | |
| 16970 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 16971 | .ops = &snd_hda_bind_sw, |
| 16972 | .values = { |
| 16973 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16974 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 16975 | 0 |
| 16976 | }, |
| 16977 | }; |
| 16978 | |
| 16979 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 16980 | HDA_BIND_VOL("Master Playback Volume", |
| 16981 | &alc663_asus_two_bind_master_vol), |
| 16982 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 16983 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16984 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16985 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16986 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16987 | { } /* end */ |
| 16988 | }; |
| 16989 | |
| 16990 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 16991 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16992 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 16993 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16994 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16995 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16996 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16997 | { } /* end */ |
| 16998 | }; |
| 16999 | |
| 17000 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17001 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17002 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17003 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17004 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17005 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17006 | |
| 17007 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17008 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17009 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17010 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17011 | { } /* end */ |
| 17012 | }; |
| 17013 | |
| 17014 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17015 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17016 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17017 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17018 | |
| 17019 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17020 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17021 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17022 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17023 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17024 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17025 | { } /* end */ |
| 17026 | }; |
| 17027 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17028 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17029 | .ops = &snd_hda_bind_sw, |
| 17030 | .values = { |
| 17031 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17032 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17033 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17034 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17035 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17036 | 0 |
| 17037 | }, |
| 17038 | }; |
| 17039 | |
| 17040 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17041 | .ops = &snd_hda_bind_sw, |
| 17042 | .values = { |
| 17043 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17044 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17045 | 0 |
| 17046 | }, |
| 17047 | }; |
| 17048 | |
| 17049 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17050 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17051 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17052 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17053 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17054 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17055 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17056 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17057 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17058 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17059 | { } /* end */ |
| 17060 | }; |
| 17061 | |
| 17062 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17063 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17064 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17065 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17066 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17067 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17068 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17069 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17070 | { } /* end */ |
| 17071 | }; |
| 17072 | |
| 17073 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17074 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17075 | { |
| 17076 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17077 | .name = "Channel Mode", |
| 17078 | .info = alc_ch_mode_info, |
| 17079 | .get = alc_ch_mode_get, |
| 17080 | .put = alc_ch_mode_put, |
| 17081 | }, |
| 17082 | { } /* end */ |
| 17083 | }; |
| 17084 | |
| 17085 | static struct hda_verb alc662_init_verbs[] = { |
| 17086 | /* ADC: mute amp left and right */ |
| 17087 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17088 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17089 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17090 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17091 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17092 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17093 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17094 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17095 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17096 | |
| 17097 | /* Front Pin: output 0 (0x0c) */ |
| 17098 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17099 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17100 | |
| 17101 | /* Rear Pin: output 1 (0x0d) */ |
| 17102 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17103 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17104 | |
| 17105 | /* CLFE Pin: output 2 (0x0e) */ |
| 17106 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17107 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17108 | |
| 17109 | /* Mic (rear) pin: input vref at 80% */ |
| 17110 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17111 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17112 | /* Front Mic pin: input vref at 80% */ |
| 17113 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17114 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17115 | /* Line In pin: input */ |
| 17116 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17117 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17118 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17119 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17120 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17121 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17122 | /* CD pin widget for input */ |
| 17123 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17124 | |
| 17125 | /* FIXME: use matrix-type input source selection */ |
| 17126 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17127 | /* Input mixer */ |
| 17128 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17129 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17130 | |
| 17131 | /* always trun on EAPD */ |
| 17132 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17133 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17134 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17135 | { } |
| 17136 | }; |
| 17137 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17138 | static struct hda_verb alc663_init_verbs[] = { |
| 17139 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17140 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17141 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17142 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17143 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17144 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17145 | { } |
| 17146 | }; |
| 17147 | |
| 17148 | static struct hda_verb alc272_init_verbs[] = { |
| 17149 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17150 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17151 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17152 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17153 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17154 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17155 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17156 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17157 | { } |
| 17158 | }; |
| 17159 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17160 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17161 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17162 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17163 | {} |
| 17164 | }; |
| 17165 | |
| 17166 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17167 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17168 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17169 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17170 | }; |
| 17171 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17172 | /* Set Unsolicited Event*/ |
| 17173 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17174 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17175 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17176 | {} |
| 17177 | }; |
| 17178 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17179 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17180 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17181 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17182 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17183 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17184 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17185 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17186 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17187 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17188 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17189 | {} |
| 17190 | }; |
| 17191 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17192 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17193 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17194 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17195 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17196 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17197 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17198 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17199 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17200 | {} |
| 17201 | }; |
| 17202 | |
| 17203 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17204 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17205 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17206 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17207 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17208 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17209 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17210 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17211 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17212 | {} |
| 17213 | }; |
| 17214 | |
| 17215 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17216 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17217 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17218 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17219 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17220 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17221 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17222 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17223 | {} |
| 17224 | }; |
| 17225 | |
| 17226 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17227 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17228 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17229 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17230 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17231 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17232 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17233 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17234 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17235 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17236 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17237 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17238 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17239 | {} |
| 17240 | }; |
| 17241 | |
| 17242 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 17243 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17244 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17245 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17246 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17247 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17248 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17249 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17250 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17251 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17252 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17253 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17254 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17255 | {} |
| 17256 | }; |
| 17257 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17258 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 17259 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17260 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 17261 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 17262 | |
| 17263 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17264 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17265 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17266 | |
| 17267 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17268 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17269 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 17270 | {} |
| 17271 | }; |
| 17272 | |
| 17273 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 17274 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17275 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17276 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17277 | |
| 17278 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17279 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17280 | {} |
| 17281 | }; |
| 17282 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17283 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 17284 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 17285 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17286 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17287 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17288 | {} |
| 17289 | }; |
| 17290 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17291 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 17292 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17293 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17294 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17295 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17296 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17297 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17298 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17299 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17300 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17301 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17302 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17303 | {} |
| 17304 | }; |
| 17305 | |
| 17306 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 17307 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17308 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17309 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17310 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17311 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17312 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17313 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17314 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17315 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17316 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17317 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17318 | {} |
| 17319 | }; |
| 17320 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17321 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 17322 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17323 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17324 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17325 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17326 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17327 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17328 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17329 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17330 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17331 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17332 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17333 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17334 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17335 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17336 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17337 | {} |
| 17338 | }; |
| 17339 | |
| 17340 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 17341 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17342 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17343 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17344 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17345 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17346 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17347 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17348 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17349 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17350 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17351 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17352 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17353 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17354 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17355 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17356 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17357 | {} |
| 17358 | }; |
| 17359 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17360 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 17361 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 17362 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 17363 | { } /* end */ |
| 17364 | }; |
| 17365 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17366 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 17367 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 17368 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 17369 | { } /* end */ |
| 17370 | }; |
| 17371 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17372 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 17373 | { |
| 17374 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17375 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17376 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17377 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17378 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17379 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17380 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17381 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17382 | } |
| 17383 | |
| 17384 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 17385 | { |
| 17386 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17387 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17388 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17389 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17390 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17391 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17392 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17393 | HDA_AMP_MUTE, bits); |
| 17394 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17395 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17396 | } |
| 17397 | |
| 17398 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 17399 | unsigned int res) |
| 17400 | { |
| 17401 | if ((res >> 26) == ALC880_HP_EVENT) |
| 17402 | alc662_lenovo_101e_all_automute(codec); |
| 17403 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 17404 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 17405 | } |
| 17406 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17407 | /* unsolicited event for HP jack sensing */ |
| 17408 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 17409 | unsigned int res) |
| 17410 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17411 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17412 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17413 | else |
| 17414 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17415 | } |
| 17416 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17417 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17418 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17419 | struct alc_spec *spec = codec->spec; |
| 17420 | |
| 17421 | alc262_hippo1_setup(codec); |
| 17422 | spec->ext_mic.pin = 0x18; |
| 17423 | spec->ext_mic.mux_idx = 0; |
| 17424 | spec->int_mic.pin = 0x19; |
| 17425 | spec->int_mic.mux_idx = 1; |
| 17426 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17427 | } |
| 17428 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17429 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 17430 | { |
| 17431 | alc262_hippo_automute(codec); |
| 17432 | alc_mic_automute(codec); |
| 17433 | } |
| 17434 | |
| 17435 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17436 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17437 | struct alc_spec *spec = codec->spec; |
| 17438 | |
| 17439 | spec->autocfg.hp_pins[0] = 0x14; |
| 17440 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17441 | } |
| 17442 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17443 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 17444 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17445 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 17446 | { |
| 17447 | unsigned int present; |
| 17448 | unsigned char bits; |
| 17449 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17450 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17451 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17452 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17453 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17454 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17455 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17456 | } |
| 17457 | |
| 17458 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 17459 | { |
| 17460 | unsigned int present; |
| 17461 | unsigned char bits; |
| 17462 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17463 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17464 | bits = present ? HDA_AMP_MUTE : 0; |
| 17465 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17466 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17467 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17468 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17469 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17470 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17471 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17472 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17473 | } |
| 17474 | |
| 17475 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 17476 | { |
| 17477 | unsigned int present; |
| 17478 | unsigned char bits; |
| 17479 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17480 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17481 | bits = present ? HDA_AMP_MUTE : 0; |
| 17482 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17483 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17484 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17485 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17486 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17487 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17488 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17489 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17490 | } |
| 17491 | |
| 17492 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 17493 | { |
| 17494 | unsigned int present; |
| 17495 | unsigned char bits; |
| 17496 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17497 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17498 | bits = present ? 0 : PIN_OUT; |
| 17499 | snd_hda_codec_write(codec, 0x14, 0, |
| 17500 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 17501 | } |
| 17502 | |
| 17503 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 17504 | { |
| 17505 | unsigned int present1, present2; |
| 17506 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17507 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 17508 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17509 | |
| 17510 | if (present1 || present2) { |
| 17511 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17512 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17513 | } else { |
| 17514 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17515 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17516 | } |
| 17517 | } |
| 17518 | |
| 17519 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 17520 | { |
| 17521 | unsigned int present1, present2; |
| 17522 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17523 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 17524 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17525 | |
| 17526 | if (present1 || present2) { |
| 17527 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17528 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17529 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17530 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17531 | } else { |
| 17532 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17533 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17534 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17535 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17536 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17537 | } |
| 17538 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17539 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 17540 | { |
| 17541 | unsigned int present1, present2; |
| 17542 | |
| 17543 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 17544 | AC_VERB_GET_PIN_SENSE, 0) |
| 17545 | & AC_PINSENSE_PRESENCE; |
| 17546 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 17547 | AC_VERB_GET_PIN_SENSE, 0) |
| 17548 | & AC_PINSENSE_PRESENCE; |
| 17549 | |
| 17550 | if (present1 || present2) { |
| 17551 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17552 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17553 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17554 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17555 | } else { |
| 17556 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17557 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17558 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17559 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17560 | } |
| 17561 | } |
| 17562 | |
| 17563 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 17564 | { |
| 17565 | unsigned int present1, present2; |
| 17566 | |
| 17567 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 17568 | AC_VERB_GET_PIN_SENSE, 0) |
| 17569 | & AC_PINSENSE_PRESENCE; |
| 17570 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 17571 | AC_VERB_GET_PIN_SENSE, 0) |
| 17572 | & AC_PINSENSE_PRESENCE; |
| 17573 | |
| 17574 | if (present1 || present2) { |
| 17575 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17576 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17577 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17578 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17579 | } else { |
| 17580 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17581 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17582 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17583 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17584 | } |
| 17585 | } |
| 17586 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17587 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 17588 | unsigned int res) |
| 17589 | { |
| 17590 | switch (res >> 26) { |
| 17591 | case ALC880_HP_EVENT: |
| 17592 | alc663_m51va_speaker_automute(codec); |
| 17593 | break; |
| 17594 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17595 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17596 | break; |
| 17597 | } |
| 17598 | } |
| 17599 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17600 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 17601 | { |
| 17602 | struct alc_spec *spec = codec->spec; |
| 17603 | spec->ext_mic.pin = 0x18; |
| 17604 | spec->ext_mic.mux_idx = 0; |
| 17605 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17606 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17607 | spec->auto_mic = 1; |
| 17608 | } |
| 17609 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17610 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 17611 | { |
| 17612 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17613 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17614 | } |
| 17615 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17616 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17617 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17618 | |
| 17619 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 17620 | { |
| 17621 | struct alc_spec *spec = codec->spec; |
| 17622 | spec->ext_mic.pin = 0x18; |
| 17623 | spec->ext_mic.mux_idx = 0; |
| 17624 | spec->int_mic.pin = 0x19; |
| 17625 | spec->int_mic.mux_idx = 1; |
| 17626 | spec->auto_mic = 1; |
| 17627 | } |
| 17628 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17629 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17630 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17631 | /* ***************** Mode2 ******************************/ |
| 17632 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 17633 | unsigned int res) |
| 17634 | { |
| 17635 | switch (res >> 26) { |
| 17636 | case ALC880_HP_EVENT: |
| 17637 | alc662_f5z_speaker_automute(codec); |
| 17638 | break; |
| 17639 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17640 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17641 | break; |
| 17642 | } |
| 17643 | } |
| 17644 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17645 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17646 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17647 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 17648 | { |
| 17649 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17650 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17651 | } |
| 17652 | /* ***************** Mode3 ******************************/ |
| 17653 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 17654 | unsigned int res) |
| 17655 | { |
| 17656 | switch (res >> 26) { |
| 17657 | case ALC880_HP_EVENT: |
| 17658 | alc663_two_hp_m1_speaker_automute(codec); |
| 17659 | break; |
| 17660 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17661 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17662 | break; |
| 17663 | } |
| 17664 | } |
| 17665 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17666 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17667 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17668 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 17669 | { |
| 17670 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17671 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17672 | } |
| 17673 | /* ***************** Mode4 ******************************/ |
| 17674 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 17675 | unsigned int res) |
| 17676 | { |
| 17677 | switch (res >> 26) { |
| 17678 | case ALC880_HP_EVENT: |
| 17679 | alc663_21jd_two_speaker_automute(codec); |
| 17680 | break; |
| 17681 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17682 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17683 | break; |
| 17684 | } |
| 17685 | } |
| 17686 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17687 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17688 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17689 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 17690 | { |
| 17691 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17692 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17693 | } |
| 17694 | /* ***************** Mode5 ******************************/ |
| 17695 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 17696 | unsigned int res) |
| 17697 | { |
| 17698 | switch (res >> 26) { |
| 17699 | case ALC880_HP_EVENT: |
| 17700 | alc663_15jd_two_speaker_automute(codec); |
| 17701 | break; |
| 17702 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17703 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17704 | break; |
| 17705 | } |
| 17706 | } |
| 17707 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17708 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17709 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17710 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 17711 | { |
| 17712 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17713 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17714 | } |
| 17715 | /* ***************** Mode6 ******************************/ |
| 17716 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 17717 | unsigned int res) |
| 17718 | { |
| 17719 | switch (res >> 26) { |
| 17720 | case ALC880_HP_EVENT: |
| 17721 | alc663_two_hp_m2_speaker_automute(codec); |
| 17722 | break; |
| 17723 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17724 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17725 | break; |
| 17726 | } |
| 17727 | } |
| 17728 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17729 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17730 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17731 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 17732 | { |
| 17733 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17734 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17735 | } |
| 17736 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17737 | /* ***************** Mode7 ******************************/ |
| 17738 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 17739 | unsigned int res) |
| 17740 | { |
| 17741 | switch (res >> 26) { |
| 17742 | case ALC880_HP_EVENT: |
| 17743 | alc663_two_hp_m7_speaker_automute(codec); |
| 17744 | break; |
| 17745 | case ALC880_MIC_EVENT: |
| 17746 | alc_mic_automute(codec); |
| 17747 | break; |
| 17748 | } |
| 17749 | } |
| 17750 | |
| 17751 | #define alc663_mode7_setup alc663_mode1_setup |
| 17752 | |
| 17753 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 17754 | { |
| 17755 | alc663_two_hp_m7_speaker_automute(codec); |
| 17756 | alc_mic_automute(codec); |
| 17757 | } |
| 17758 | |
| 17759 | /* ***************** Mode8 ******************************/ |
| 17760 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 17761 | unsigned int res) |
| 17762 | { |
| 17763 | switch (res >> 26) { |
| 17764 | case ALC880_HP_EVENT: |
| 17765 | alc663_two_hp_m8_speaker_automute(codec); |
| 17766 | break; |
| 17767 | case ALC880_MIC_EVENT: |
| 17768 | alc_mic_automute(codec); |
| 17769 | break; |
| 17770 | } |
| 17771 | } |
| 17772 | |
| 17773 | #define alc663_mode8_setup alc663_m51va_setup |
| 17774 | |
| 17775 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 17776 | { |
| 17777 | alc663_two_hp_m8_speaker_automute(codec); |
| 17778 | alc_mic_automute(codec); |
| 17779 | } |
| 17780 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17781 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 17782 | { |
| 17783 | unsigned int present; |
| 17784 | unsigned char bits; |
| 17785 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17786 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17787 | bits = present ? HDA_AMP_MUTE : 0; |
| 17788 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17789 | HDA_AMP_MUTE, bits); |
| 17790 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17791 | HDA_AMP_MUTE, bits); |
| 17792 | } |
| 17793 | |
| 17794 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 17795 | { |
| 17796 | unsigned int present; |
| 17797 | unsigned char bits; |
| 17798 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17799 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17800 | bits = present ? HDA_AMP_MUTE : 0; |
| 17801 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17802 | HDA_AMP_MUTE, bits); |
| 17803 | } |
| 17804 | |
| 17805 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 17806 | unsigned int res) |
| 17807 | { |
| 17808 | switch (res >> 26) { |
| 17809 | case ALC880_HP_EVENT: |
| 17810 | alc663_g71v_hp_automute(codec); |
| 17811 | break; |
| 17812 | case ALC880_FRONT_EVENT: |
| 17813 | alc663_g71v_front_automute(codec); |
| 17814 | break; |
| 17815 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17816 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17817 | break; |
| 17818 | } |
| 17819 | } |
| 17820 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17821 | #define alc663_g71v_setup alc663_m51va_setup |
| 17822 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17823 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 17824 | { |
| 17825 | alc663_g71v_front_automute(codec); |
| 17826 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17827 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17828 | } |
| 17829 | |
| 17830 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 17831 | unsigned int res) |
| 17832 | { |
| 17833 | switch (res >> 26) { |
| 17834 | case ALC880_HP_EVENT: |
| 17835 | alc663_m51va_speaker_automute(codec); |
| 17836 | break; |
| 17837 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17838 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17839 | break; |
| 17840 | } |
| 17841 | } |
| 17842 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17843 | #define alc663_g50v_setup alc663_m51va_setup |
| 17844 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17845 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 17846 | { |
| 17847 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17848 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17849 | } |
| 17850 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17851 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 17852 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17853 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17854 | |
| 17855 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 17856 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17857 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17858 | |
| 17859 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17860 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17861 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17862 | { } /* end */ |
| 17863 | }; |
| 17864 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17865 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 17866 | /* Master Playback automatically created from Speaker and Headphone */ |
| 17867 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17868 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17869 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17870 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17871 | |
| 17872 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17873 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17874 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 17875 | |
| 17876 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17877 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17878 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 17879 | { } /* end */ |
| 17880 | }; |
| 17881 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17882 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17883 | #define alc662_loopbacks alc880_loopbacks |
| 17884 | #endif |
| 17885 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17886 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17887 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17888 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 17889 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 17890 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 17891 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 17892 | |
| 17893 | /* |
| 17894 | * configuration and preset |
| 17895 | */ |
| 17896 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 17897 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 17898 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 17899 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 17900 | [ALC662_5ST_DIG] = "6stack-dig", |
| 17901 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 17902 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17903 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17904 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17905 | [ALC663_ASUS_M51VA] = "m51va", |
| 17906 | [ALC663_ASUS_G71V] = "g71v", |
| 17907 | [ALC663_ASUS_H13] = "h13", |
| 17908 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17909 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 17910 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 17911 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 17912 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 17913 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 17914 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17915 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 17916 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 17917 | [ALC272_DELL] = "dell", |
| 17918 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17919 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17920 | [ALC662_AUTO] = "auto", |
| 17921 | }; |
| 17922 | |
| 17923 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17924 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17925 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 17926 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17927 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 17928 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17929 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17930 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 17931 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 17932 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 17933 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17934 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 17935 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17936 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17937 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 17938 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 17939 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 17940 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 17941 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17942 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17943 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 17944 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17945 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 17946 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 17947 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 17948 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17949 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17950 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 17951 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 17952 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17953 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 17954 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 17955 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 17956 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17957 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17958 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 17959 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17960 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17961 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 17962 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 17963 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17964 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17965 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17966 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 17967 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17968 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 17969 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 17970 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17971 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17972 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 17973 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17974 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17975 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 17976 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17977 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 17978 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 17979 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17980 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17981 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 17982 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 17983 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17984 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17985 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17986 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 17987 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 17988 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 17989 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17990 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 17991 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 17992 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17993 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 17994 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 17995 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17996 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 17997 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 17998 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17999 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18000 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18001 | {} |
| 18002 | }; |
| 18003 | |
| 18004 | static struct alc_config_preset alc662_presets[] = { |
| 18005 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18006 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18007 | .init_verbs = { alc662_init_verbs }, |
| 18008 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18009 | .dac_nids = alc662_dac_nids, |
| 18010 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18011 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18012 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18013 | .channel_mode = alc662_3ST_2ch_modes, |
| 18014 | .input_mux = &alc662_capture_source, |
| 18015 | }, |
| 18016 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18017 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18018 | .init_verbs = { alc662_init_verbs }, |
| 18019 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18020 | .dac_nids = alc662_dac_nids, |
| 18021 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18022 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18023 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18024 | .channel_mode = alc662_3ST_6ch_modes, |
| 18025 | .need_dac_fix = 1, |
| 18026 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18027 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18028 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18029 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18030 | .init_verbs = { alc662_init_verbs }, |
| 18031 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18032 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18033 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18034 | .channel_mode = alc662_3ST_6ch_modes, |
| 18035 | .need_dac_fix = 1, |
| 18036 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18037 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18038 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18039 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18040 | .init_verbs = { alc662_init_verbs }, |
| 18041 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18042 | .dac_nids = alc662_dac_nids, |
| 18043 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18044 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18045 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18046 | .channel_mode = alc662_5stack_modes, |
| 18047 | .input_mux = &alc662_capture_source, |
| 18048 | }, |
| 18049 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18050 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18051 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18052 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18053 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18054 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18055 | .channel_mode = alc662_3ST_2ch_modes, |
| 18056 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18057 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18058 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18059 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18060 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18061 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18062 | .init_verbs = { alc662_init_verbs, |
| 18063 | alc662_eeepc_sue_init_verbs }, |
| 18064 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18065 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18066 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18067 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18068 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18069 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18070 | .init_hook = alc662_eeepc_inithook, |
| 18071 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18072 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18073 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18074 | alc662_chmode_mixer }, |
| 18075 | .init_verbs = { alc662_init_verbs, |
| 18076 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18077 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18078 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18079 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18080 | .channel_mode = alc662_3ST_6ch_modes, |
| 18081 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18082 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18083 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18084 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18085 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18086 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18087 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18088 | .init_verbs = { alc662_init_verbs, |
| 18089 | alc662_ecs_init_verbs }, |
| 18090 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18091 | .dac_nids = alc662_dac_nids, |
| 18092 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18093 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18094 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18095 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18096 | .init_hook = alc662_eeepc_inithook, |
| 18097 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18098 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18099 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18100 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18101 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18102 | .dac_nids = alc662_dac_nids, |
| 18103 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18104 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18105 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18106 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18107 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18108 | .init_hook = alc663_m51va_inithook, |
| 18109 | }, |
| 18110 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18111 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18112 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 18113 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18114 | .dac_nids = alc662_dac_nids, |
| 18115 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18116 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18117 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18118 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18119 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18120 | .init_hook = alc663_g71v_inithook, |
| 18121 | }, |
| 18122 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18123 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18124 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18125 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18126 | .dac_nids = alc662_dac_nids, |
| 18127 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18128 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18129 | .unsol_event = alc663_m51va_unsol_event, |
| 18130 | .init_hook = alc663_m51va_inithook, |
| 18131 | }, |
| 18132 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18133 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18134 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18135 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18136 | .dac_nids = alc662_dac_nids, |
| 18137 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18138 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18139 | .channel_mode = alc662_3ST_6ch_modes, |
| 18140 | .input_mux = &alc663_capture_source, |
| 18141 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18142 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18143 | .init_hook = alc663_g50v_inithook, |
| 18144 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18145 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18146 | .mixers = { alc663_m51va_mixer }, |
| 18147 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18148 | .init_verbs = { alc662_init_verbs, |
| 18149 | alc663_21jd_amic_init_verbs }, |
| 18150 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18151 | .hp_nid = 0x03, |
| 18152 | .dac_nids = alc662_dac_nids, |
| 18153 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18154 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18155 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18156 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18157 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18158 | .init_hook = alc663_mode1_inithook, |
| 18159 | }, |
| 18160 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18161 | .mixers = { alc662_1bjd_mixer }, |
| 18162 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18163 | .init_verbs = { alc662_init_verbs, |
| 18164 | alc662_1bjd_amic_init_verbs }, |
| 18165 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18166 | .dac_nids = alc662_dac_nids, |
| 18167 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18168 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18169 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18170 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18171 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18172 | .init_hook = alc662_mode2_inithook, |
| 18173 | }, |
| 18174 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18175 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18176 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18177 | .init_verbs = { alc662_init_verbs, |
| 18178 | alc663_two_hp_amic_m1_init_verbs }, |
| 18179 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18180 | .hp_nid = 0x03, |
| 18181 | .dac_nids = alc662_dac_nids, |
| 18182 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18183 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18184 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18185 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18186 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18187 | .init_hook = alc663_mode3_inithook, |
| 18188 | }, |
| 18189 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18190 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18191 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18192 | .init_verbs = { alc662_init_verbs, |
| 18193 | alc663_21jd_amic_init_verbs}, |
| 18194 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18195 | .hp_nid = 0x03, |
| 18196 | .dac_nids = alc662_dac_nids, |
| 18197 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18198 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18199 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18200 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18201 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18202 | .init_hook = alc663_mode4_inithook, |
| 18203 | }, |
| 18204 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18205 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18206 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18207 | .init_verbs = { alc662_init_verbs, |
| 18208 | alc663_15jd_amic_init_verbs }, |
| 18209 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18210 | .hp_nid = 0x03, |
| 18211 | .dac_nids = alc662_dac_nids, |
| 18212 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18213 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18214 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18215 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18216 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18217 | .init_hook = alc663_mode5_inithook, |
| 18218 | }, |
| 18219 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18220 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18221 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18222 | .init_verbs = { alc662_init_verbs, |
| 18223 | alc663_two_hp_amic_m2_init_verbs }, |
| 18224 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18225 | .hp_nid = 0x03, |
| 18226 | .dac_nids = alc662_dac_nids, |
| 18227 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18228 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18229 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18230 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18231 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18232 | .init_hook = alc663_mode6_inithook, |
| 18233 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18234 | [ALC663_ASUS_MODE7] = { |
| 18235 | .mixers = { alc663_mode7_mixer }, |
| 18236 | .cap_mixer = alc662_auto_capture_mixer, |
| 18237 | .init_verbs = { alc662_init_verbs, |
| 18238 | alc663_mode7_init_verbs }, |
| 18239 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18240 | .hp_nid = 0x03, |
| 18241 | .dac_nids = alc662_dac_nids, |
| 18242 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18243 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18244 | .channel_mode = alc662_3ST_2ch_modes, |
| 18245 | .unsol_event = alc663_mode7_unsol_event, |
| 18246 | .setup = alc663_mode7_setup, |
| 18247 | .init_hook = alc663_mode7_inithook, |
| 18248 | }, |
| 18249 | [ALC663_ASUS_MODE8] = { |
| 18250 | .mixers = { alc663_mode8_mixer }, |
| 18251 | .cap_mixer = alc662_auto_capture_mixer, |
| 18252 | .init_verbs = { alc662_init_verbs, |
| 18253 | alc663_mode8_init_verbs }, |
| 18254 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18255 | .hp_nid = 0x03, |
| 18256 | .dac_nids = alc662_dac_nids, |
| 18257 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18258 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18259 | .channel_mode = alc662_3ST_2ch_modes, |
| 18260 | .unsol_event = alc663_mode8_unsol_event, |
| 18261 | .setup = alc663_mode8_setup, |
| 18262 | .init_hook = alc663_mode8_inithook, |
| 18263 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18264 | [ALC272_DELL] = { |
| 18265 | .mixers = { alc663_m51va_mixer }, |
| 18266 | .cap_mixer = alc272_auto_capture_mixer, |
| 18267 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 18268 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18269 | .dac_nids = alc662_dac_nids, |
| 18270 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18271 | .adc_nids = alc272_adc_nids, |
| 18272 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18273 | .capsrc_nids = alc272_capsrc_nids, |
| 18274 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18275 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18276 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18277 | .init_hook = alc663_m51va_inithook, |
| 18278 | }, |
| 18279 | [ALC272_DELL_ZM1] = { |
| 18280 | .mixers = { alc663_m51va_mixer }, |
| 18281 | .cap_mixer = alc662_auto_capture_mixer, |
| 18282 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 18283 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18284 | .dac_nids = alc662_dac_nids, |
| 18285 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18286 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18287 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18288 | .capsrc_nids = alc662_capsrc_nids, |
| 18289 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18290 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18291 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18292 | .init_hook = alc663_m51va_inithook, |
| 18293 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18294 | [ALC272_SAMSUNG_NC10] = { |
| 18295 | .mixers = { alc272_nc10_mixer }, |
| 18296 | .init_verbs = { alc662_init_verbs, |
| 18297 | alc663_21jd_amic_init_verbs }, |
| 18298 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18299 | .dac_nids = alc272_dac_nids, |
| 18300 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18301 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18302 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18303 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18304 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18305 | .init_hook = alc663_mode4_inithook, |
| 18306 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18307 | }; |
| 18308 | |
| 18309 | |
| 18310 | /* |
| 18311 | * BIOS auto configuration |
| 18312 | */ |
| 18313 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18314 | /* convert from MIX nid to DAC */ |
| 18315 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 18316 | { |
| 18317 | if (nid == 0x0f) |
| 18318 | return 0x02; |
| 18319 | else if (nid >= 0x0c && nid <= 0x0e) |
| 18320 | return nid - 0x0c + 0x02; |
| 18321 | else |
| 18322 | return 0; |
| 18323 | } |
| 18324 | |
| 18325 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 18326 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 18327 | hda_nid_t dac) |
| 18328 | { |
| 18329 | hda_nid_t mix[4]; |
| 18330 | int i, num; |
| 18331 | |
| 18332 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18333 | for (i = 0; i < num; i++) { |
| 18334 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 18335 | return mix[i]; |
| 18336 | } |
| 18337 | return 0; |
| 18338 | } |
| 18339 | |
| 18340 | /* look for an empty DAC slot */ |
| 18341 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 18342 | { |
| 18343 | struct alc_spec *spec = codec->spec; |
| 18344 | hda_nid_t srcs[5]; |
| 18345 | int i, j, num; |
| 18346 | |
| 18347 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 18348 | if (num < 0) |
| 18349 | return 0; |
| 18350 | for (i = 0; i < num; i++) { |
| 18351 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 18352 | if (!nid) |
| 18353 | continue; |
| 18354 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 18355 | if (spec->multiout.dac_nids[j] == nid) |
| 18356 | break; |
| 18357 | if (j >= spec->multiout.num_dacs) |
| 18358 | return nid; |
| 18359 | } |
| 18360 | return 0; |
| 18361 | } |
| 18362 | |
| 18363 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 18364 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 18365 | const struct auto_pin_cfg *cfg) |
| 18366 | { |
| 18367 | struct alc_spec *spec = codec->spec; |
| 18368 | int i; |
| 18369 | hda_nid_t dac; |
| 18370 | |
| 18371 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 18372 | for (i = 0; i < cfg->line_outs; i++) { |
| 18373 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 18374 | if (!dac) |
| 18375 | continue; |
| 18376 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 18377 | } |
| 18378 | return 0; |
| 18379 | } |
| 18380 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18381 | 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] | 18382 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18383 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18384 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18385 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 18386 | } |
| 18387 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18388 | 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] | 18389 | hda_nid_t nid, unsigned int chs) |
| 18390 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18391 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18392 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 18393 | } |
| 18394 | |
| 18395 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 18396 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 18397 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 18398 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 18399 | |
| 18400 | /* add playback controls from the parsed DAC table */ |
| 18401 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 18402 | const struct auto_pin_cfg *cfg) |
| 18403 | { |
| 18404 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18405 | static const char *chname[4] = { |
| 18406 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 18407 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18408 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18409 | int i, err; |
| 18410 | |
| 18411 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18412 | nid = spec->multiout.dac_nids[i]; |
| 18413 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18414 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18415 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 18416 | if (!mix) |
| 18417 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18418 | if (i == 2) { |
| 18419 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18420 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18421 | if (err < 0) |
| 18422 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18423 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18424 | if (err < 0) |
| 18425 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18426 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18427 | if (err < 0) |
| 18428 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18429 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18430 | if (err < 0) |
| 18431 | return err; |
| 18432 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18433 | const char *pfx; |
| 18434 | if (cfg->line_outs == 1 && |
| 18435 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18436 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18437 | pfx = "Speaker"; |
| 18438 | else |
| 18439 | pfx = "PCM"; |
| 18440 | } else |
| 18441 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18442 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18443 | if (err < 0) |
| 18444 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18445 | if (cfg->line_outs == 1 && |
| 18446 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 18447 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18448 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18449 | if (err < 0) |
| 18450 | return err; |
| 18451 | } |
| 18452 | } |
| 18453 | return 0; |
| 18454 | } |
| 18455 | |
| 18456 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18457 | /* return DAC nid if any new DAC is assigned */ |
| 18458 | 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] | 18459 | const char *pfx) |
| 18460 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18461 | struct alc_spec *spec = codec->spec; |
| 18462 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18463 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18464 | |
| 18465 | if (!pin) |
| 18466 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18467 | nid = alc662_look_for_dac(codec, pin); |
| 18468 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18469 | /* the corresponding DAC is already occupied */ |
| 18470 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 18471 | return 0; /* no way */ |
| 18472 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18473 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18474 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 18475 | } |
| 18476 | |
| 18477 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 18478 | if (!mix) |
| 18479 | return 0; |
| 18480 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 18481 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 18482 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18483 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 18484 | if (err < 0) |
| 18485 | return err; |
| 18486 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18487 | } |
| 18488 | |
| 18489 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18490 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 18491 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18492 | |
| 18493 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 18494 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18495 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18496 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18497 | int i, num; |
| 18498 | hda_nid_t srcs[4]; |
| 18499 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18500 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18501 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18502 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 18503 | if (num <= 1) |
| 18504 | return; |
| 18505 | for (i = 0; i < num; i++) { |
| 18506 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 18507 | continue; |
| 18508 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 18509 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18510 | } |
| 18511 | } |
| 18512 | |
| 18513 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 18514 | { |
| 18515 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18516 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18517 | int i; |
| 18518 | |
| 18519 | for (i = 0; i <= HDA_SIDE; i++) { |
| 18520 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 18521 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 18522 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18523 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18524 | } |
| 18525 | } |
| 18526 | |
| 18527 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 18528 | { |
| 18529 | struct alc_spec *spec = codec->spec; |
| 18530 | hda_nid_t pin; |
| 18531 | |
| 18532 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18533 | if (pin) |
| 18534 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 18535 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18536 | pin = spec->autocfg.speaker_pins[0]; |
| 18537 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18538 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 18539 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18540 | } |
| 18541 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18542 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 18543 | |
| 18544 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 18545 | { |
| 18546 | struct alc_spec *spec = codec->spec; |
| 18547 | int i; |
| 18548 | |
| 18549 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 18550 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18551 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 18552 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 18553 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 18554 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18555 | snd_hda_codec_write(codec, nid, 0, |
| 18556 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 18557 | AMP_OUT_MUTE); |
| 18558 | } |
| 18559 | } |
| 18560 | } |
| 18561 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18562 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 18563 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18564 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 18565 | { |
| 18566 | struct alc_spec *spec = codec->spec; |
| 18567 | int err; |
| 18568 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 18569 | |
| 18570 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 18571 | alc662_ignore); |
| 18572 | if (err < 0) |
| 18573 | return err; |
| 18574 | if (!spec->autocfg.line_outs) |
| 18575 | return 0; /* can't find valid BIOS pin config */ |
| 18576 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18577 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18578 | if (err < 0) |
| 18579 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18580 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18581 | if (err < 0) |
| 18582 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18583 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18584 | spec->autocfg.speaker_pins[0], |
| 18585 | "Speaker"); |
| 18586 | if (err < 0) |
| 18587 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18588 | if (err) |
| 18589 | spec->multiout.extra_out_nid[0] = err; |
| 18590 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18591 | "Headphone"); |
| 18592 | if (err < 0) |
| 18593 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18594 | if (err) |
| 18595 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18596 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18597 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18598 | return err; |
| 18599 | |
| 18600 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 18601 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 18602 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18603 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 18604 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 18605 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 18606 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18607 | |
| 18608 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 18609 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 18610 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18611 | add_verb(spec, alc662_init_verbs); |
| 18612 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 18613 | codec->vendor_id == 0x10ec0665) |
| 18614 | add_verb(spec, alc663_init_verbs); |
| 18615 | |
| 18616 | if (codec->vendor_id == 0x10ec0272) |
| 18617 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 18618 | |
| 18619 | err = alc_auto_add_mic_boost(codec); |
| 18620 | if (err < 0) |
| 18621 | return err; |
| 18622 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18623 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 18624 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 18625 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 18626 | else |
| 18627 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 18628 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18629 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18630 | } |
| 18631 | |
| 18632 | /* additional initialization for auto-configuration model */ |
| 18633 | static void alc662_auto_init(struct hda_codec *codec) |
| 18634 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18635 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18636 | alc662_auto_init_multi_out(codec); |
| 18637 | alc662_auto_init_hp_out(codec); |
| 18638 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18639 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18640 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 18641 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18642 | } |
| 18643 | |
| 18644 | static int patch_alc662(struct hda_codec *codec) |
| 18645 | { |
| 18646 | struct alc_spec *spec; |
| 18647 | int err, board_config; |
| 18648 | |
| 18649 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 18650 | if (!spec) |
| 18651 | return -ENOMEM; |
| 18652 | |
| 18653 | codec->spec = spec; |
| 18654 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 18655 | alc_auto_parse_customize_define(codec); |
| 18656 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 18657 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 18658 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 18659 | if (alc_read_coef_idx(codec, 0) == 0x8020) |
| 18660 | alc_codec_rename(codec, "ALC661"); |
| 18661 | else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) && |
| 18662 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 18663 | spec->cdefine.platform_type == 1) |
| 18664 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18665 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18666 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 18667 | alc662_models, |
| 18668 | alc662_cfg_tbl); |
| 18669 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 18670 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 18671 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18672 | board_config = ALC662_AUTO; |
| 18673 | } |
| 18674 | |
| 18675 | if (board_config == ALC662_AUTO) { |
| 18676 | /* automatic parse from the BIOS config */ |
| 18677 | err = alc662_parse_auto_config(codec); |
| 18678 | if (err < 0) { |
| 18679 | alc_free(codec); |
| 18680 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18681 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18682 | printk(KERN_INFO |
| 18683 | "hda_codec: Cannot set up configuration " |
| 18684 | "from BIOS. Using base mode...\n"); |
| 18685 | board_config = ALC662_3ST_2ch_DIG; |
| 18686 | } |
| 18687 | } |
| 18688 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 18689 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 18690 | if (err < 0) { |
| 18691 | alc_free(codec); |
| 18692 | return err; |
| 18693 | } |
| 18694 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18695 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 18696 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18697 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18698 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 18699 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 18700 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18701 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 18702 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 18703 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 18704 | if (!spec->adc_nids) { |
| 18705 | spec->adc_nids = alc662_adc_nids; |
| 18706 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 18707 | } |
| 18708 | if (!spec->capsrc_nids) |
| 18709 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18710 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18711 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18712 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18713 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 18714 | if (spec->cdefine.enable_pcbeep) { |
| 18715 | switch (codec->vendor_id) { |
| 18716 | case 0x10ec0662: |
| 18717 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 18718 | break; |
| 18719 | case 0x10ec0272: |
| 18720 | case 0x10ec0663: |
| 18721 | case 0x10ec0665: |
| 18722 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 18723 | break; |
| 18724 | case 0x10ec0273: |
| 18725 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 18726 | break; |
| 18727 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18728 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 18729 | spec->vmaster_nid = 0x02; |
| 18730 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18731 | codec->patch_ops = alc_patch_ops; |
| 18732 | if (board_config == ALC662_AUTO) |
| 18733 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18734 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18735 | if (!spec->loopback.amplist) |
| 18736 | spec->loopback.amplist = alc662_loopbacks; |
| 18737 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18738 | |
| 18739 | return 0; |
| 18740 | } |
| 18741 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18742 | static int patch_alc888(struct hda_codec *codec) |
| 18743 | { |
| 18744 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 18745 | kfree(codec->chip_name); |
| 18746 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18747 | if (!codec->chip_name) { |
| 18748 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18749 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18750 | } |
| 18751 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18752 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18753 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18754 | } |
| 18755 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18756 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18757 | * patch entries |
| 18758 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 18759 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18760 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 18761 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 18762 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 18763 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 18764 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18765 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 18766 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18767 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18768 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18769 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18770 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 18771 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 18772 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18773 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18774 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18775 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 18776 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18777 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18778 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18779 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18780 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18781 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18782 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 18783 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18784 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 18785 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18786 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 18787 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18788 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 18789 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18790 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18791 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18792 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18793 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18794 | {} /* terminator */ |
| 18795 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 18796 | |
| 18797 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 18798 | |
| 18799 | MODULE_LICENSE("GPL"); |
| 18800 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 18801 | |
| 18802 | static struct hda_codec_preset_list realtek_list = { |
| 18803 | .preset = snd_hda_preset_realtek, |
| 18804 | .owner = THIS_MODULE, |
| 18805 | }; |
| 18806 | |
| 18807 | static int __init patch_realtek_init(void) |
| 18808 | { |
| 18809 | return snd_hda_add_codec_preset(&realtek_list); |
| 18810 | } |
| 18811 | |
| 18812 | static void __exit patch_realtek_exit(void) |
| 18813 | { |
| 18814 | snd_hda_delete_codec_preset(&realtek_list); |
| 18815 | } |
| 18816 | |
| 18817 | module_init(patch_realtek_init) |
| 18818 | module_exit(patch_realtek_exit) |